diff --git a/src/oatpp/core/data/stream/Stream.cpp b/src/oatpp/core/data/stream/Stream.cpp index d23ee35b..7a2013e2 100644 --- a/src/oatpp/core/data/stream/Stream.cpp +++ b/src/oatpp/core/data/stream/Stream.cpp @@ -727,7 +727,11 @@ async::CoroutineStarter transferAsync(const base::ObjectHandle& re switch(res) { case IOError::BROKEN_PIPE: - return error("[oatpp::data::stream::transferAsync]: Error. ReadCallback. BROKEN_PIPE."); + if(m_transferSize > 0) { + return error("[oatpp::data::stream::transferAsync]: Error. ReadCallback. BROKEN_PIPE."); + } + m_inData.set(nullptr, 0); + break; case IOError::ZERO_VALUE: m_inData.set(nullptr, 0); @@ -746,10 +750,13 @@ async::CoroutineStarter transferAsync(const base::ObjectHandle& re return repeat(); default: - if(!action.isNone()) { - return action; + if(m_transferSize > 0) { + if (!action.isNone()) { + return action; + } + return error("[oatpp::data::stream::transferAsync]: Error. ReadCallback. Unknown IO error."); } - return error("[oatpp::data::stream::transferAsync]: Error. ReadCallback. Unknown IO error."); + m_inData.set(nullptr, 0); } diff --git a/test/oatpp/network/monitor/ConnectionMonitorTest.cpp b/test/oatpp/network/monitor/ConnectionMonitorTest.cpp index 86859551..eb59d498 100644 --- a/test/oatpp/network/monitor/ConnectionMonitorTest.cpp +++ b/test/oatpp/network/monitor/ConnectionMonitorTest.cpp @@ -46,7 +46,7 @@ class ReadCallback : public oatpp::data::stream::ReadCallback { public: v_io_size read(void *buffer, v_buff_size count, async::Action &action) override { - OATPP_LOGE("TEST", "read(...)") + OATPP_LOGI("TEST", "read(...)") std::this_thread::sleep_for(std::chrono::milliseconds(100)); char* data = (char*) buffer; data[0] = 'A';