|
|
|
@ -1424,17 +1424,15 @@ namespace transport
@@ -1424,17 +1424,15 @@ namespace transport
|
|
|
|
|
else |
|
|
|
|
LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ()); |
|
|
|
|
} |
|
|
|
|
else if (error == boost::asio::error::no_descriptors) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
i2p::context.SetError (eRouterErrorNoDescriptors); |
|
|
|
|
if (m_NoFileExhaustTimestamp < i2p::util::GetSecondsSinceEpoch () - NTCP2_DESCRIPTORS_EXHAUST_TIMEOUT) |
|
|
|
|
LogPrint (eLogError, "NTCP2: Accept error ", error.message ()); |
|
|
|
|
if (error == boost::asio::error::no_descriptors) |
|
|
|
|
{ |
|
|
|
|
m_NoFileExhaustTimestamp = i2p::util::GetSecondsSinceEpoch (); |
|
|
|
|
LogPrint (eLogWarning, "NTCP2: WARNING! i2pd met file descriptors exhaustion! Please check your nofile limits!"); |
|
|
|
|
i2p::context.SetError (eRouterErrorNoDescriptors); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
LogPrint (eLogError, "NTCP2: Accept error ", error.message ()); |
|
|
|
|
|
|
|
|
|
if (error != boost::asio::error::operation_aborted) |
|
|
|
|
{ |
|
|
|
@ -1464,26 +1462,21 @@ namespace transport
@@ -1464,26 +1462,21 @@ namespace transport
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
LogPrint (eLogError, "NTCP2: Connected from ipv6 error: ", ec.message ()); |
|
|
|
|
LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ()); |
|
|
|
|
} |
|
|
|
|
else if (error == boost::asio::error::no_descriptors) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
i2p::context.SetErrorV6 (eRouterErrorNoDescriptors); |
|
|
|
|
if (m_NoFileExhaustTimestamp < i2p::util::GetSecondsSinceEpoch () - NTCP2_DESCRIPTORS_EXHAUST_TIMEOUT) |
|
|
|
|
LogPrint (eLogError, "NTCP2: Accept ipv6 error ", error.message ()); |
|
|
|
|
if (error == boost::asio::error::no_descriptors) |
|
|
|
|
{ |
|
|
|
|
m_NoFileExhaustTimestamp = i2p::util::GetSecondsSinceEpoch (); |
|
|
|
|
LogPrint (eLogWarning, "NTCP2: WARNING! i2pd met file descriptors exhaustion! Please check your nofile limits!"); |
|
|
|
|
i2p::context.SetErrorV6 (eRouterErrorNoDescriptors); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
LogPrint (eLogError, "NTCP2: Accept ipv6 error: ", error.message ()); |
|
|
|
|
|
|
|
|
|
if (error != boost::asio::error::operation_aborted) |
|
|
|
|
{ |
|
|
|
|
if (!conn) // connection is used, create new one
|
|
|
|
|
conn = std::make_shared<NTCP2Session> (*this); |
|
|
|
|
else // reuse failed
|
|
|
|
|
conn->Close (); |
|
|
|
|
m_NTCP2V6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAcceptV6, this, |
|
|
|
|
conn, std::placeholders::_1)); |
|
|
|
|
} |
|
|
|
@ -1524,8 +1517,24 @@ namespace transport
@@ -1524,8 +1517,24 @@ namespace transport
|
|
|
|
|
else |
|
|
|
|
it++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ScheduleTermination (); |
|
|
|
|
|
|
|
|
|
// try to restart acceptors if no description
|
|
|
|
|
// we do it after timer to let timer take descriptor first
|
|
|
|
|
if (i2p::context.GetError () == eRouterErrorNoDescriptors) |
|
|
|
|
{ |
|
|
|
|
i2p::context.SetError (eRouterErrorNone); |
|
|
|
|
auto conn = std::make_shared<NTCP2Session> (*this); |
|
|
|
|
m_NTCP2Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAccept, this, |
|
|
|
|
conn, std::placeholders::_1)); |
|
|
|
|
} |
|
|
|
|
if (i2p::context.GetErrorV6 () == eRouterErrorNoDescriptors) |
|
|
|
|
{ |
|
|
|
|
i2p::context.SetErrorV6 (eRouterErrorNone); |
|
|
|
|
auto conn = std::make_shared<NTCP2Session> (*this); |
|
|
|
|
m_NTCP2V6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAcceptV6, this, |
|
|
|
|
conn, std::placeholders::_1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|