Browse Source

[ssu2] close socket if it was opened on OpenSocket

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1879/head
R4SAS 1 year ago
parent
commit
3c65012a63
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 12
      libi2pd/SSU2.cpp

12
libi2pd/SSU2.cpp

@ -212,6 +212,8 @@ namespace transport @@ -212,6 +212,8 @@ namespace transport
boost::asio::ip::udp::socket& socket = localEndpoint.address ().is_v6 () ? m_SocketV6 : m_SocketV4;
try
{
if (socket.is_open ())
socket.close ();
socket.open (localEndpoint.protocol ());
if (localEndpoint.address ().is_v6 ())
socket.set_option (boost::asio::ip::v6_only (true));
@ -819,7 +821,7 @@ namespace transport @@ -819,7 +821,7 @@ namespace transport
m_CleanupTimer.async_wait (std::bind (&SSU2Server::HandleCleanupTimer,
this, std::placeholders::_1));
}
void SSU2Server::HandleCleanupTimer (const boost::system::error_code& ecode)
{
if (ecode != boost::asio::error::operation_aborted)
@ -848,15 +850,15 @@ namespace transport @@ -848,15 +850,15 @@ namespace transport
else
it++;
}
m_PacketsPool.CleanUpMt ();
m_SentPacketsPool.CleanUp ();
m_IncompleteMessagesPool.CleanUp ();
m_FragmentsPool.CleanUp ();
ScheduleCleanup ();
}
}
}
}
void SSU2Server::ScheduleResend (bool more)
{
m_ResendTimer.expires_from_now (boost::posix_time::milliseconds (more ? SSU2_RESEND_CHECK_MORE_TIMEOUT :

Loading…
Cancel
Save