make sure all outstading data got sent before closing socket

This commit is contained in:
orignal 2016-12-13 11:01:13 -05:00
parent e1d9eca7bd
commit c45f72a63e
2 changed files with 11 additions and 4 deletions

View file

@ -92,8 +92,15 @@ namespace client
m_Stream->Close ();
m_Stream.reset ();
}
m_Socket->close ();
Done(shared_from_this ());
auto s = shared_from_this ();
// make sure all outstading jobs finished before close
m_Socket->get_io_service ().post(
[s]()
{
s->m_Socket->close ();
});
Done(s);
}
void I2PTunnelConnection::Receive ()