mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 02:54:01 +01:00
cleanup acceptor for AcceptOnce
This commit is contained in:
parent
4448884a3e
commit
1f76dc78d8
|
@ -1091,16 +1091,18 @@ namespace stream
|
|||
}
|
||||
else // we must save old acceptor and set it back
|
||||
{
|
||||
auto oldAcceptor = m_Acceptor;
|
||||
m_Acceptor = [acceptor, oldAcceptor, this](std::shared_ptr<Stream> stream)
|
||||
{
|
||||
acceptor (stream); // m_Acceptor might be set after
|
||||
m_Acceptor = oldAcceptor; // so we must restore old one before
|
||||
};
|
||||
m_Acceptor = std::bind (&StreamingDestination::AcceptOnceAcceptor, this,
|
||||
std::placeholders::_1, acceptor, m_Acceptor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void StreamingDestination::AcceptOnceAcceptor (std::shared_ptr<Stream> stream, Acceptor acceptor, Acceptor prev)
|
||||
{
|
||||
m_Acceptor = prev;
|
||||
acceptor (stream);
|
||||
}
|
||||
|
||||
void StreamingDestination::HandlePendingIncomingTimer (const boost::system::error_code& ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
|
|
|
@ -280,7 +280,9 @@ namespace stream
|
|||
void DeletePacket (Packet * p) { if (p) m_PacketsPool.Release (p); };
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void AcceptOnceAcceptor (std::shared_ptr<Stream> stream, Acceptor acceptor, Acceptor prev);
|
||||
|
||||
void HandleNextPacket (Packet * packet);
|
||||
std::shared_ptr<Stream> CreateNewIncomingStream ();
|
||||
void HandlePendingIncomingTimer (const boost::system::error_code& ecode);
|
||||
|
|
Loading…
Reference in a new issue