mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-19 01:09:58 +00:00
[ssu2] close socket if it was opened on OpenSocket
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
97b7ea0da5
commit
3c65012a63
@ -212,6 +212,8 @@ namespace transport
|
|||||||
boost::asio::ip::udp::socket& socket = localEndpoint.address ().is_v6 () ? m_SocketV6 : m_SocketV4;
|
boost::asio::ip::udp::socket& socket = localEndpoint.address ().is_v6 () ? m_SocketV6 : m_SocketV4;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (socket.is_open ())
|
||||||
|
socket.close ();
|
||||||
socket.open (localEndpoint.protocol ());
|
socket.open (localEndpoint.protocol ());
|
||||||
if (localEndpoint.address ().is_v6 ())
|
if (localEndpoint.address ().is_v6 ())
|
||||||
socket.set_option (boost::asio::ip::v6_only (true));
|
socket.set_option (boost::asio::ip::v6_only (true));
|
||||||
@ -819,7 +821,7 @@ namespace transport
|
|||||||
m_CleanupTimer.async_wait (std::bind (&SSU2Server::HandleCleanupTimer,
|
m_CleanupTimer.async_wait (std::bind (&SSU2Server::HandleCleanupTimer,
|
||||||
this, std::placeholders::_1));
|
this, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSU2Server::HandleCleanupTimer (const boost::system::error_code& ecode)
|
void SSU2Server::HandleCleanupTimer (const boost::system::error_code& ecode)
|
||||||
{
|
{
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
@ -848,15 +850,15 @@ namespace transport
|
|||||||
else
|
else
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PacketsPool.CleanUpMt ();
|
m_PacketsPool.CleanUpMt ();
|
||||||
m_SentPacketsPool.CleanUp ();
|
m_SentPacketsPool.CleanUp ();
|
||||||
m_IncompleteMessagesPool.CleanUp ();
|
m_IncompleteMessagesPool.CleanUp ();
|
||||||
m_FragmentsPool.CleanUp ();
|
m_FragmentsPool.CleanUp ();
|
||||||
ScheduleCleanup ();
|
ScheduleCleanup ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSU2Server::ScheduleResend (bool more)
|
void SSU2Server::ScheduleResend (bool more)
|
||||||
{
|
{
|
||||||
m_ResendTimer.expires_from_now (boost::posix_time::milliseconds (more ? SSU2_RESEND_CHECK_MORE_TIMEOUT :
|
m_ResendTimer.expires_from_now (boost::posix_time::milliseconds (more ? SSU2_RESEND_CHECK_MORE_TIMEOUT :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user