mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
close socket after if accept failed
This commit is contained in:
parent
704fca969f
commit
0abb871f3f
|
@ -1356,8 +1356,10 @@ namespace transport
|
|||
|
||||
if (error != boost::asio::error::operation_aborted)
|
||||
{
|
||||
if (!conn) // connection is used
|
||||
if (!conn) // connection is used, create new one
|
||||
conn = std::make_shared<NTCP2Session> (*this);
|
||||
else // reuse failed
|
||||
conn->Close ();
|
||||
m_NTCP2Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAccept, this,
|
||||
conn, std::placeholders::_1));
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ namespace transport
|
|||
void Terminate ();
|
||||
void TerminateByTimeout ();
|
||||
void Done ();
|
||||
void Close () { m_Socket.close (); }; // for accept
|
||||
|
||||
boost::asio::ip::tcp::socket& GetSocket () { return m_Socket; };
|
||||
|
||||
|
|
Loading…
Reference in a new issue