mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 06:54:15 +00: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 (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);
|
conn = std::make_shared<NTCP2Session> (*this);
|
||||||
|
else // reuse failed
|
||||||
|
conn->Close ();
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@ namespace transport
|
|||||||
void Terminate ();
|
void Terminate ();
|
||||||
void TerminateByTimeout ();
|
void TerminateByTimeout ();
|
||||||
void Done ();
|
void Done ();
|
||||||
|
void Close () { m_Socket.close (); }; // for accept
|
||||||
|
|
||||||
boost::asio::ip::tcp::socket& GetSocket () { return m_Socket; };
|
boost::asio::ip::tcp::socket& GetSocket () { return m_Socket; };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user