mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-13 19:37:51 +00:00
handle accept errors
This commit is contained in:
parent
95debf8c80
commit
704fca969f
@ -1345,15 +1345,19 @@ namespace transport
|
|||||||
{
|
{
|
||||||
conn->ServerLogin ();
|
conn->ServerLogin ();
|
||||||
m_PendingIncomingSessions.push_back (conn);
|
m_PendingIncomingSessions.push_back (conn);
|
||||||
|
conn = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ());
|
LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "NTCP2: Accept error ", error.message ());
|
||||||
|
|
||||||
if (error != boost::asio::error::operation_aborted)
|
if (error != boost::asio::error::operation_aborted)
|
||||||
{
|
{
|
||||||
conn = std::make_shared<NTCP2Session> (*this);
|
if (!conn) // connection is used
|
||||||
|
conn = std::make_shared<NTCP2Session> (*this);
|
||||||
m_NTCP2Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAccept, this,
|
m_NTCP2Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAccept, this,
|
||||||
conn, std::placeholders::_1));
|
conn, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
@ -1409,13 +1413,13 @@ namespace transport
|
|||||||
// pending
|
// pending
|
||||||
for (auto it = m_PendingIncomingSessions.begin (); it != m_PendingIncomingSessions.end ();)
|
for (auto it = m_PendingIncomingSessions.begin (); it != m_PendingIncomingSessions.end ();)
|
||||||
{
|
{
|
||||||
if ((*it)->IsEstablished () || (*it)->IsTerminated ())
|
if ((*it)->IsEstablished () || (*it)->IsTerminationTimeoutExpired (ts))
|
||||||
it = m_PendingIncomingSessions.erase (it); // established or terminated
|
|
||||||
else if ((*it)->IsTerminationTimeoutExpired (ts))
|
|
||||||
{
|
{
|
||||||
(*it)->Terminate ();
|
(*it)->Terminate ();
|
||||||
it = m_PendingIncomingSessions.erase (it); // expired
|
it = m_PendingIncomingSessions.erase (it); // etsablished of expired
|
||||||
}
|
}
|
||||||
|
else if ((*it)->IsTerminated ())
|
||||||
|
it = m_PendingIncomingSessions.erase (it); // already terminated
|
||||||
else
|
else
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user