mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-13 04:46:38 +01:00
Merge pull request #1076 from majestrate/fix-streaming-race-2018-01-25
try streaming race condition fix
This commit is contained in:
commit
e8d6c803cd
1 changed files with 3 additions and 1 deletions
|
@ -578,7 +578,9 @@ namespace stream
|
||||||
if (m_SentPackets.empty () && m_SendBuffer.IsEmpty ()) // nothing to send
|
if (m_SentPackets.empty () && m_SendBuffer.IsEmpty ()) // nothing to send
|
||||||
{
|
{
|
||||||
m_Status = eStreamStatusClosed;
|
m_Status = eStreamStatusClosed;
|
||||||
SendClose ();
|
// close could be called from another thread so do SendClose from the destination thread
|
||||||
|
// this is so m_LocalDestination.NewPacket () does not trigger a race condition
|
||||||
|
m_Service.post(std::bind(&Stream::SendClose, shared_from_this()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eStreamStatusClosed:
|
case eStreamStatusClosed:
|
||||||
|
|
Loading…
Add table
Reference in a new issue