mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
correct behaviour of IsAcceptorSet
This commit is contained in:
parent
719de94821
commit
e7b1ded486
|
@ -867,6 +867,7 @@ namespace stream
|
||||||
{
|
{
|
||||||
ResetAcceptor ();
|
ResetAcceptor ();
|
||||||
m_PendingIncomingTimer.cancel ();
|
m_PendingIncomingTimer.cancel ();
|
||||||
|
m_PendingIncomingStreams.clear ();
|
||||||
m_ConnTrackTimer.cancel();
|
m_ConnTrackTimer.cancel();
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_StreamsMutex);
|
std::unique_lock<std::mutex> l(m_StreamsMutex);
|
||||||
|
@ -1020,14 +1021,16 @@ namespace stream
|
||||||
|
|
||||||
void StreamingDestination::SetAcceptor (const Acceptor& acceptor)
|
void StreamingDestination::SetAcceptor (const Acceptor& acceptor)
|
||||||
{
|
{
|
||||||
m_Owner->GetService ().post([acceptor, this](void)
|
m_Acceptor = acceptor; // we must set it immediately for IsAcceptorSet
|
||||||
|
auto s = shared_from_this ();
|
||||||
|
m_Owner->GetService ().post([s](void)
|
||||||
{
|
{
|
||||||
m_Acceptor = acceptor;
|
// take care about incoming queue
|
||||||
for (auto& it: m_PendingIncomingStreams)
|
for (auto& it: s->m_PendingIncomingStreams)
|
||||||
if (it->GetStatus () == eStreamStatusOpen) // still open?
|
if (it->GetStatus () == eStreamStatusOpen) // still open?
|
||||||
m_Acceptor (it);
|
s->m_Acceptor (it);
|
||||||
m_PendingIncomingStreams.clear ();
|
s->m_PendingIncomingStreams.clear ();
|
||||||
m_PendingIncomingTimer.cancel ();
|
s->m_PendingIncomingTimer.cancel ();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue