Skip to content

Commit bb2e337

Browse files
mergify[bot]jepemi
andauthored
TCP socket send buffer limit (#646) (#658)
* TCP socket send buffer limit (#646) * Refs #20119: Add non_blocking_send to TCPTransportDescriptor Signed-off-by: Jesus Perez <jesusperez@eprosima.com> * Refs #20119: non_blocking_send moved to properties Signed-off-by: Jesus Perez <jesusperez@eprosima.com> * Refs #20119: Apply suggestions Signed-off-by: Jesus Perez <jesusperez@eprosima.com> --------- Signed-off-by: Jesus Perez <jesusperez@eprosima.com> (cherry picked from commit b74412f) # Conflicts: # code/XMLTester.xml # docs/fastdds/rtps_layer/rtps_layer.rst * Refs #20119: Solve conflicts Signed-off-by: Jesus Perez <jesusperez@eprosima.com> * Refs #20119: Remove non_blocking_send true from large data Signed-off-by: Jesus Perez <jesusperez@eprosima.com> --------- Signed-off-by: Jesus Perez <jesusperez@eprosima.com> Co-authored-by: Jesús Pérez <78275223+jepemi@users.noreply.github.com> Co-authored-by: Jesus Perez <jesusperez@eprosima.com>
1 parent 5105db6 commit bb2e337

4 files changed

Lines changed: 70 additions & 3 deletions

File tree

code/DDSCodeTester.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,17 @@ void dds_domain_examples()
796796
"unicast");
797797
//!--
798798
}
799+
800+
{
801+
//DDS-TCP-NON-BLOCKING-SEND
802+
DomainParticipantQos participant_qos;
803+
804+
// TCP transport will use non-blocking send
805+
participant_qos.properties().properties().emplace_back(
806+
"fastdds.tcp_transport.non_blocking_send",
807+
"true");
808+
//!--
809+
}
799810
}
800811

801812
//DOMAINPARTICIPANTLISTENER-DISCOVERY-CALLBACKS

code/XMLTester.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3883,6 +3883,21 @@
38833883
-->
38843884
<!--><-->
38853885

3886+
<!-->XML-TCP-NON-BLOCKING-SEND<-->
3887+
<participant profile_name="participant_xml_conf_tcp_non_blocking_send">
3888+
<rtps>
3889+
<propertiesPolicy>
3890+
<properties>
3891+
<property>
3892+
<name>fastdds.tcp_transport.non_blocking_send</name>
3893+
<value>true</value>
3894+
</property>
3895+
</properties>
3896+
</propertiesPolicy>
3897+
</rtps>
3898+
</participant>
3899+
<!--><-->
3900+
38863901
<!-->LARGE_DATA_BUILTIN_TRANSPORTS<-->
38873902
<!--
38883903
<?xml version="1.0" encoding="UTF-8" ?>

docs/fastdds/property_policies/non_consolidated_qos.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,47 @@ The behavior regarding this can be configured using the property ``fastdds.shm.e
351351
:language: xml
352352
:start-after: <!-->XML-SHM-ENFORCE-META-TRAFFIC
353353
:end-before: <!--><-->
354+
355+
.. _property_policies_tcp_non_blocking_send:
356+
357+
TCP Non-blocking send
358+
^^^^^^^^^^^^^^^^^^^^^
359+
360+
TCP transport will by default configure a :ref:`transport_tcp_tcp` with blocking send calls.
361+
When ``fastdds.tcp_transport.non_blocking_send`` property is set to ``true``, send operations will
362+
return immediately if the send buffer is full, but no error will be returned to the upper layer.
363+
This means that the application will behave as if the packet is sent and lost.
364+
365+
When set to ``false``, send operations will block until the network buffer has space for the
366+
packet.
367+
368+
.. list-table::
369+
:header-rows: 1
370+
:align: left
371+
372+
* - PropertyPolicyQos value
373+
- Description
374+
- Default
375+
* - ``"false"``
376+
- Block on send operations when send buffer is full.
377+
- ✅
378+
* - ``"true"``
379+
- Do not block on send operations when send buffer is full.
380+
-
381+
382+
.. tabs::
383+
384+
.. tab:: C++
385+
386+
.. literalinclude:: /../code/DDSCodeTester.cpp
387+
:language: c++
388+
:start-after: //DDS-TCP-NON-BLOCKING-SEND
389+
:end-before: //!--
390+
:dedent: 8
391+
392+
.. tab:: XML
393+
394+
.. literalinclude:: /../code/XMLTester.xml
395+
:language: xml
396+
:start-after: <!-->XML-TCP-NON-BLOCKING-SEND
397+
:end-before: <!--><-->

docs/fastdds/transport/tcp/tcp.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,3 @@ A TCP version of helloworld example can be found in the
347347
`HelloWorldExampleTCP folder <https://github.com/eProsima/Fast-DDS/tree/master/examples/C%2B%2B/DDS/HelloWorldExampleTCP>`_.
348348
It shows a publisher and a subscriber that communicate through TCP.
349349
The publisher is configured as *TCP server* while the Subscriber is acting as *TCP client*.
350-
351-
352-

0 commit comments

Comments
 (0)