@@ -77,14 +77,10 @@ namespace rtps {
7777
7878using Log = fastdds::dds::Log;
7979
80- static const int s_default_keep_alive_frequency = 5000 ; // 5 SECONDS
81- static const int s_default_keep_alive_timeout = 15000 ; // 15 SECONDS
82- // static const int s_clean_deleted_sockets_pool_timeout = 100; // 100 MILLISECONDS
83-
8480TCPTransportDescriptor::TCPTransportDescriptor ()
8581 : SocketTransportDescriptor(s_maximumMessageSize, s_maximumInitialPeersRange)
86- , keep_alive_frequency_ms(s_default_keep_alive_frequency )
87- , keep_alive_timeout_ms(s_default_keep_alive_timeout )
82+ , keep_alive_frequency_ms(0 )
83+ , keep_alive_timeout_ms(0 )
8884 , max_logical_port(100 )
8985 , logical_port_range(20 )
9086 , logical_port_increment(2 )
@@ -168,7 +164,6 @@ TCPTransportInterface::TCPTransportInterface(
168164#if TLS_FOUND
169165 , ssl_context_(asio::ssl::context::sslv23)
170166#endif // if TLS_FOUND
171- , keep_alive_event_(io_context_timers_)
172167{
173168}
174169
@@ -181,13 +176,6 @@ void TCPTransportInterface::clean()
181176 assert (receiver_resources_.size () == 0 );
182177 alive_.store (false );
183178
184- keep_alive_event_.cancel ();
185- if (io_context_timers_thread_.joinable ())
186- {
187- io_context_timers_.stop ();
188- io_context_timers_thread_.join ();
189- }
190-
191179 {
192180 std::vector<std::shared_ptr<TCPChannelResource>> channels;
193181 std::vector<eprosima::fastdds::rtps::Locator> delete_channels;
@@ -583,14 +571,7 @@ bool TCPTransportInterface::init(
583571
584572 if (0 < configuration ()->keep_alive_frequency_ms )
585573 {
586- auto ioContextTimersFunction = [&]()
587- {
588- asio::executor_work_guard<asio::io_context::executor_type> work = make_work_guard (io_context_timers_.
589- get_executor ());
590- io_context_timers_.run ();
591- };
592- io_context_timers_thread_ = create_thread (ioContextTimersFunction,
593- configuration ()->keep_alive_thread , " dds.tcp_keep" );
574+ EPROSIMA_LOG_WARNING (RTCP, " Keep alive feature only available in Fast DDS Pro." );
594575 }
595576
596577 return true ;
@@ -1075,64 +1056,6 @@ bool TCPTransportInterface::OpenInputChannel(
10751056 return success;
10761057}
10771058
1078- void TCPTransportInterface::keep_alive ()
1079- {
1080- std::map<Locator, std::shared_ptr<TCPChannelResource>> tmp_vec;
1081-
1082- {
1083- std::unique_lock<std::mutex> scopedLock (sockets_map_mutex_); // Why mutex here?
1084- tmp_vec = channel_resources_;
1085- }
1086-
1087-
1088- for (auto & channel_resource : tmp_vec)
1089- {
1090- if (TCPChannelResource::TCPConnectionType::TCP_CONNECT_TYPE == channel_resource.second ->tcp_connection_type ())
1091- {
1092- rtcp_message_manager_->sendKeepAliveRequest (channel_resource.second );
1093- }
1094- }
1095- // TODO Check timeout.
1096-
1097- /*
1098- const TCPTransportDescriptor* config = configuration(); // Keep a copy for us.
1099-
1100- std::chrono::time_point<std::chrono::system_clock> time_now = std::chrono::system_clock::now();
1101- std::chrono::time_point<std::chrono::system_clock> next_time = time_now +
1102- std::chrono::milliseconds(config->keep_alive_frequency_ms);
1103- std::chrono::time_point<std::chrono::system_clock> timeout_time =
1104- time_now + std::chrono::milliseconds(config->keep_alive_timeout_ms);
1105-
1106- while (channel && TCPChannelResource::TCPConnectionStatus::TCP_CONNECTED == channel->tcp_connection_status())
1107- {
1108- if (channel->connection_established())
1109- {
1110- // KeepAlive
1111- if (config->keep_alive_frequency_ms > 0 && config->keep_alive_timeout_ms > 0)
1112- {
1113- time_now = std::chrono::system_clock::now();
1114-
1115- // Keep Alive Management
1116- if (!channel->waiting_for_keep_alive_ && time_now > next_time)
1117- {
1118- std::unique_lock<std::mutex> scopedLock(sockets_map_mutex_); // Why mutex here?
1119- rtcp_message_manager_->sendKeepAliveRequest(channel);
1120- channel->waiting_for_keep_alive_ = true;
1121- next_time = time_now + std::chrono::milliseconds(config->keep_alive_frequency_ms);
1122- timeout_time = time_now + std::chrono::milliseconds(config->keep_alive_timeout_ms);
1123- }
1124- else if (channel->waiting_for_keep_alive_ && time_now >= timeout_time)
1125- {
1126- // Disable the socket to erase it after the reception.
1127- close_tcp_socket(channel);
1128- }
1129- }
1130- }
1131- }
1132- EPROSIMA_LOG_INFO(RTCP, "End perform_rtcp_management_thread " << channel->locator());
1133- */
1134- }
1135-
11361059void TCPTransportInterface::create_listening_thread (
11371060 const std::shared_ptr<TCPChannelResource>& channel)
11381061{
0 commit comments