diff --git a/libi2pd_client/AddressBook.cpp b/libi2pd_client/AddressBook.cpp index 8469e7a4..b71ee5eb 100644 --- a/libi2pd_client/AddressBook.cpp +++ b/libi2pd_client/AddressBook.cpp @@ -1002,7 +1002,7 @@ namespace client req.set (boost::beast::http::field::if_modified_since, m_LastModified); // If-Modified-Since req.keep_alive (false); // Connection: close - i2p::client::BoostAsyncStream httpStream (stream); + i2p::client::BoostAsyncStream httpStream (stream, SUBSCRIPTION_REQUEST_TIMEOUT); std::future sending = boost::beast::http::async_write (httpStream, req, boost::asio::use_future); try { diff --git a/libi2pd_client/BoostStream.h b/libi2pd_client/BoostStream.h index b7aec1b3..e21e058e 100644 --- a/libi2pd_client/BoostStream.h +++ b/libi2pd_client/BoostStream.h @@ -23,7 +23,8 @@ namespace client using executor_type = boost::asio::any_io_executor; - BoostAsyncStream (std::shared_ptr stream): m_Stream (stream) {} + BoostAsyncStream (std::shared_ptr stream, int receiveTimeout = i2p::stream::MAX_RECEIVE_TIMEOUT): + m_Stream (stream), m_ReceiveTimeout (receiveTimeout) {} std::shared_ptr GetStream () const { return m_Stream; } @@ -48,7 +49,7 @@ namespace client // read stream after close, return eof with outstanding data handler (boost::asio::error::make_error_code (boost::asio::error::eof), 0); else if (bufs.size () > 0) // wait for incoming data - m_Stream->AsyncReceive (*boost::asio::buffer_sequence_begin (bufs), std::move (handler), i2p::stream::MAX_RECEIVE_TIMEOUT); + m_Stream->AsyncReceive (*boost::asio::buffer_sequence_begin (bufs), std::move (handler), m_ReceiveTimeout); else handler (boost::system::error_code (), 0); } @@ -87,6 +88,7 @@ namespace client private: std::shared_ptr m_Stream; + int m_ReceiveTimeout; }; } }