mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-21 16:49:10 +01:00
read all available data from closed stream
This commit is contained in:
parent
89b6be91a3
commit
fe13a85c0f
1 changed files with 13 additions and 3 deletions
16
Streaming.h
16
Streaming.h
|
@ -224,9 +224,19 @@ namespace stream
|
||||||
// no error
|
// no error
|
||||||
handler (boost::system::error_code (), received);
|
handler (boost::system::error_code (), received);
|
||||||
else
|
else
|
||||||
// socket closed
|
{
|
||||||
handler (m_IsReset ? boost::asio::error::make_error_code (boost::asio::error::connection_reset) :
|
// stream closed
|
||||||
boost::asio::error::make_error_code (boost::asio::error::operation_aborted), received);
|
if (m_IsReset)
|
||||||
|
{
|
||||||
|
// stream closed by peer
|
||||||
|
handler (received > 0 ? boost::system::error_code () : // we still have some data
|
||||||
|
boost::asio::error::make_error_code (boost::asio::error::connection_reset), // no more data
|
||||||
|
received);
|
||||||
|
|
||||||
|
}
|
||||||
|
else // stream closed by us
|
||||||
|
handler (boost::asio::error::make_error_code (boost::asio::error::operation_aborted), received);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// timeout expired
|
// timeout expired
|
||||||
|
|
Loading…
Add table
Reference in a new issue