Skip to content

Commit dc0c4b9

Browse files
Fix socket buffer size handling (#5921)
* [23459] Fix typo Signed-off-by: Eugenio Collado <[email protected]> * [23459] Remove buffer size upper limit Signed-off-by: Eugenio Collado <[email protected]> * [23459] Backport fix builtin socket buffer size parameter Signed-off-by: Eugenio Collado <[email protected]> * [23459] Fix test_UDPv4Transport Signed-off-by: Eugenio Collado <[email protected]> * [23459] Include removed comment Signed-off-by: Eugenio Collado <[email protected]> --------- Signed-off-by: Eugenio Collado <[email protected]>
1 parent 42288ed commit dc0c4b9

File tree

8 files changed

+22
-21
lines changed

8 files changed

+22
-21
lines changed

src/cpp/rtps/attributes/RTPSParticipantAttributes.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,11 @@ void RTPSParticipantAttributes::setup_transports(
317317
}
318318
bool intraprocess_only = is_intraprocess_only(*this);
319319

320-
sendSocketBufferSize = options.sockets_buffer_size;
321-
listenSocketBufferSize = options.sockets_buffer_size;
320+
if (options.sockets_buffer_size != 0)
321+
{
322+
sendSocketBufferSize = options.sockets_buffer_size;
323+
listenSocketBufferSize = options.sockets_buffer_size;
324+
}
322325

323326
switch (transports)
324327
{

src/cpp/rtps/transport/asio_helpers.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,9 @@ struct asio_helpers
8787
if (!ec)
8888
{
8989
// Last attempt was successful. Get the actual value set.
90-
int32_t max_value = static_cast<int32_t>(initial_buffer_value);
9190
BufferOptionType option;
9291
socket.get_option(option, ec);
93-
if (!ec && (option.value() >= value_to_set) && (option.value() <= max_value))
92+
if (!ec && (option.value() >= value_to_set))
9493
{
9594
final_buffer_value = option.value();
9695
return true;

src/cpp/rtps/transport/test_UDPv4Transport.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ test_UDPv4Transport::test_UDPv4Transport(
6565
{
6666
test_UDPv4Transport_DropLogLength = 0;
6767
test_UDPv4Transport_ShutdownAllNetwork = false;
68-
UDPv4Transport::mSendBufferSize = descriptor.sendBufferSize;
69-
UDPv4Transport::mReceiveBufferSize = descriptor.receiveBufferSize;
68+
UDPv4Transport::configuration_.sendBufferSize = descriptor.sendBufferSize;
69+
UDPv4Transport::configuration_.receiveBufferSize = descriptor.receiveBufferSize;
70+
UDPv4Transport::configuration_.maxMessageSize = descriptor.maxMessageSize;
7071
for (auto interf : descriptor.interfaceWhiteList)
7172
{
7273
UDPv4Transport::interface_whitelist_.emplace_back(asio::ip::make_address_v4(interf));

test/blackbox/api/dds-pim/PubSubReader.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,10 +1395,10 @@ class PubSubReader
13951395
}
13961396

13971397
PubSubReader& socket_buffer_size(
1398-
uint32_t sockerBufferSize)
1398+
uint32_t socketBufferSize)
13991399
{
1400-
participant_qos_.transport().listen_socket_buffer_size = sockerBufferSize;
1401-
participant_qos_.transport().send_socket_buffer_size = sockerBufferSize;
1400+
participant_qos_.transport().listen_socket_buffer_size = socketBufferSize;
1401+
participant_qos_.transport().send_socket_buffer_size = socketBufferSize;
14021402
return *this;
14031403
}
14041404

test/blackbox/api/dds-pim/PubSubWriter.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,10 +1547,10 @@ class PubSubWriter
15471547
}
15481548

15491549
PubSubWriter& socket_buffer_size(
1550-
uint32_t sockerBufferSize)
1550+
uint32_t socketBufferSize)
15511551
{
1552-
participant_qos_.transport().listen_socket_buffer_size = sockerBufferSize;
1553-
participant_qos_.transport().send_socket_buffer_size = sockerBufferSize;
1552+
participant_qos_.transport().listen_socket_buffer_size = socketBufferSize;
1553+
participant_qos_.transport().send_socket_buffer_size = socketBufferSize;
15541554
return *this;
15551555
}
15561556

test/blackbox/api/fastrtps_deprecated/PubSubReader.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,10 +1102,10 @@ class PubSubReader
11021102
}
11031103

11041104
PubSubReader& socket_buffer_size(
1105-
uint32_t sockerBufferSize)
1105+
uint32_t socketBufferSize)
11061106
{
1107-
participant_attr_.rtps.listenSocketBufferSize = sockerBufferSize;
1108-
participant_attr_.rtps.sendSocketBufferSize = sockerBufferSize;
1107+
participant_attr_.rtps.listenSocketBufferSize = socketBufferSize;
1108+
participant_attr_.rtps.sendSocketBufferSize = socketBufferSize;
11091109
return *this;
11101110
}
11111111

test/blackbox/api/fastrtps_deprecated/PubSubWriter.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,10 +1281,10 @@ class PubSubWriter
12811281
}
12821282

12831283
PubSubWriter& socket_buffer_size(
1284-
uint32_t sockerBufferSize)
1284+
uint32_t socketBufferSize)
12851285
{
1286-
participant_attr_.rtps.listenSocketBufferSize = sockerBufferSize;
1287-
participant_attr_.rtps.sendSocketBufferSize = sockerBufferSize;
1286+
participant_attr_.rtps.listenSocketBufferSize = socketBufferSize;
1287+
participant_attr_.rtps.sendSocketBufferSize = socketBufferSize;
12881288
return *this;
12891289
}
12901290

test/blackbox/common/DDSBlackboxTestsListeners.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ void sample_lost_test_dr_init(
776776
PubSubReader<T>& reader,
777777
std::function<void(const eprosima::fastdds::dds::SampleLostStatus& status)> functor)
778778
{
779+
reader.socket_buffer_size(SAMPLE_LOST_TEST_BUFFER_SIZE);
779780
reader.sample_lost_status_functor(functor)
780781
.init();
781782

@@ -788,9 +789,6 @@ void sample_lost_test_init(
788789
PubSubWriter<T>& writer,
789790
std::function<void(const eprosima::fastdds::dds::SampleLostStatus& status)> functor)
790791
{
791-
reader.socket_buffer_size(SAMPLE_LOST_TEST_BUFFER_SIZE);
792-
writer.socket_buffer_size(SAMPLE_LOST_TEST_BUFFER_SIZE);
793-
794792
sample_lost_test_dw_init(writer);
795793
sample_lost_test_dr_init(reader, functor);
796794

0 commit comments

Comments
 (0)