Skip to content

Commit

Permalink
TCP non_blocking_send moved to TCPTransportDescriptor (#678)
Browse files Browse the repository at this point in the history
* Refs #20502: non_blocking_send moved to tcp transport descriptor

Signed-off-by: Jesus Perez <[email protected]>

* Refs #20502: Apply suggestions

Signed-off-by: Jesus Perez <[email protected]>

---------

Signed-off-by: Jesus Perez <[email protected]>
  • Loading branch information
jepemi authored Feb 28, 2024
1 parent 02065d0 commit 9bb4e10
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 72 deletions.
11 changes: 0 additions & 11 deletions code/DDSCodeTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,17 +865,6 @@ void dds_domain_examples()
"unicast");
//!--
}

{
//DDS-TCP-NON-BLOCKING-SEND
DomainParticipantQos participant_qos;

// TCP transport will use non-blocking send
participant_qos.properties().properties().emplace_back(
"fastdds.tcp_transport.non_blocking_send",
"true");
//!--
}
}

//DOMAINPARTICIPANTLISTENER-DISCOVERY-CALLBACKS
Expand Down
15 changes: 0 additions & 15 deletions code/XMLTester.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3751,21 +3751,6 @@
</participant>
<!--><-->

<!-->XML-TCP-NON-BLOCKING-SEND<-->
<participant profile_name="participant_xml_conf_tcp_non_blocking_send">
<rtps>
<propertiesPolicy>
<properties>
<property>
<name>fastdds.tcp_transport.non_blocking_send</name>
<value>true</value>
</property>
</properties>
</propertiesPolicy>
</rtps>
</participant>
<!--><-->

<!-->XML_TYPELOOKUP_SERVICE_ENABLING<-->
<participant profile_name="participant_typelookup_service_enabled">
<rtps>
Expand Down
1 change: 1 addition & 0 deletions docs/03-exports/aliases-api.include
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@
.. |TCPTransportDescriptor::logical_port_range-api| replace:: :cpp:var:`logical_port_range<eprosima::fastdds::rtps::TCPTransportDescriptor::logical_port_range>`
.. |TCPTransportDescriptor::logical_port_increment-api| replace:: :cpp:var:`logical_port_increment<eprosima::fastdds::rtps::TCPTransportDescriptor::logical_port_increment>`
.. |TCPTransportDescriptor::enable_tcp_nodelay-api| replace:: :cpp:var:`enable_tcp_nodelay<eprosima::fastdds::rtps::TCPTransportDescriptor::enable_tcp_nodelay>`
.. |TCPTransportDescriptor::non_blocking_send-api| replace:: :cpp:var:`non_blocking_send<eprosima::fastdds::rtps::TCPTransportDescriptor::non_blocking_send>`
.. |TCPTransportDescriptor::calculate_crc-api| replace:: :cpp:var:`calculate_crc<eprosima::fastdds::rtps::TCPTransportDescriptor::calculate_crc>`
.. |TCPTransportDescriptor::check_crc-api| replace:: :cpp:var:`check_crc<eprosima::fastdds::rtps::TCPTransportDescriptor::check_crc>`
.. |TCPTransportDescriptor::apply_security-api| replace:: :cpp:var:`apply_security<eprosima::fastdds::rtps::TCPTransportDescriptor::apply_security>`
Expand Down
44 changes: 0 additions & 44 deletions docs/fastdds/property_policies/non_consolidated_qos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,47 +351,3 @@ The behavior regarding this can be configured using the property ``fastdds.shm.e
:language: xml
:start-after: <!-->XML-SHM-ENFORCE-META-TRAFFIC
:end-before: <!--><-->

.. _property_policies_tcp_non_blocking_send:

TCP Non-blocking send
^^^^^^^^^^^^^^^^^^^^^

TCP transport will by default configure a :ref:`transport_tcp_tcp` with blocking send calls.
When ``fastdds.tcp_transport.non_blocking_send`` property is set to ``true``, send operations will
return immediately if the send buffer is full, but no error will be returned to the upper layer.
This means that the application will behave as if the packet is sent and lost.

When set to ``false``, send operations will block until the network buffer has space for the
packet.

.. list-table::
:header-rows: 1
:align: left

* - PropertyPolicyQos value
- Description
- Default
* - ``"false"``
- Block on send operations when send buffer is full.
- ✅
* - ``"true"``
- Do not block on send operations when send buffer is full.
-

.. tabs::

.. tab:: C++

.. literalinclude:: /../code/DDSCodeTester.cpp
:language: c++
:start-after: //DDS-TCP-NON-BLOCKING-SEND
:end-before: //!--
:dedent: 8

.. tab:: XML

.. literalinclude:: /../code/XMLTester.xml
:language: xml
:start-after: <!-->XML-TCP-NON-BLOCKING-SEND
:end-before: <!--><-->
13 changes: 13 additions & 0 deletions docs/fastdds/transport/tcp/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ The following table describes the common data members for both TCPv4 and TCPv6.
- ``bool``
- ``false``
- Enables the TCP_NODELAY socket option.
* - |TCPTransportDescriptor::non_blocking_send-api|
- ``bool``
- ``false``
- Do not block on send operations (*).
* - |TCPTransportDescriptor::calculate_crc-api|
- ``bool``
- ``true``
Expand Down Expand Up @@ -134,6 +138,15 @@ The following table describes the common data members for both TCPv4 and TCPv6.
If |TCPTransportDescriptor::listening_ports-api| is left empty, the participant will not be able to receive incoming
connections but will be able to connect to other participants that have configured their listening ports.

.. note::

When |TCPTransportDescriptor::non_blocking_send-api| is set to ``true``, send operations will return immediately if the
send buffer might get full, but no error will be returned to the upper layer.
This means that the application will behave as if the packet is sent and lost.

When set to ``false``, send operations will block until the network buffer has space for the
packet.

.. _transport_tcp_v4transportDescriptor:

TCPv4TransportDescriptor
Expand Down
5 changes: 3 additions & 2 deletions docs/fastdds/xml_configuration/transports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ A more detailed explanation of each of these elements can be found in :ref:`comm
| | :ref:`transport_udp_udp`. | | |
+-------------------------------+----------------------------------------------------+----------------------+----------+
| ``<non_blocking_send>`` | Whether to set the non-blocking send mode on |br| | ``bool`` | ``false``|
| | the socket (**UDP only**). See |br| | | |
| | :ref:`transport_udp_transportDescriptor`. | | |
| | the socket (**NOT available for SHM type**). See | | |
| | |br| :ref:`transport_udp_transportDescriptor` and | | |
| | |br| :ref:`transport_tcp_transportDescriptor`. | | |
+-------------------------------+----------------------------------------------------+----------------------+----------+
| ``<output_port>`` | Port used for output bound. |br| | ``uint16_t`` | 0 |
| | If this field isn't defined, the output port |br| | | |
Expand Down

0 comments on commit 9bb4e10

Please sign in to comment.