From 012989f8fd572fa1df0f87994530644e4ede2409 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 7 Mar 2014 22:41:05 +0100 Subject: [PATCH] Retry reading from the stream instead of waiting for input data on socket. --- src/vmime/net/pop3/POP3Response.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vmime/net/pop3/POP3Response.cpp b/src/vmime/net/pop3/POP3Response.cpp index a3961200..2435a3d0 100644 --- a/src/vmime/net/pop3/POP3Response.cpp +++ b/src/vmime/net/pop3/POP3Response.cpp @@ -274,9 +274,19 @@ void POP3Response::readResponseImpl if (read == 0) // buffer is empty { if (m_socket->getStatus() & socket::STATUS_WANT_WRITE) + { m_socket->waitForWrite(); - else + } + else if (m_socket->getStatus() & socket::STATUS_WANT_READ) + { m_socket->waitForRead(); + } + else + { + // Input stream needs more bytes to continue, but there + // is enough data into socket buffer. Do not waitForRead(), + // just retry read()ing on the stream. + } continue; }