From bb116619b91ddb411a1fde847ff28204f8b2de7c Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 28 Jul 2026 21:29:40 -0400 Subject: [PATCH] return eof if read closed socket --- libi2pd_client/BoostStream.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libi2pd_client/BoostStream.h b/libi2pd_client/BoostStream.h index 49443dd9..a4410df1 100644 --- a/libi2pd_client/BoostStream.h +++ b/libi2pd_client/BoostStream.h @@ -34,6 +34,13 @@ namespace client template void async_read_some(const MutableBufferSequence& bufs, ReadHandler&& handler) { + if (m_Stream->GetStatus () == i2p::stream::eStreamStatusClosed || + m_Stream->GetStatus () == i2p::stream::eStreamStatusTerminated) + { + // read stream after close, return eof + handler (boost::asio::error::make_error_code (boost::asio::error::eof), 0); + return; + } size_t received = 0; for (auto it = boost::asio::buffer_sequence_begin (bufs); it != boost::asio::buffer_sequence_end (bufs); it++) {