From: Guillermo Rodriguez Garcia Date: Wed, 15 Mar 2000 14:35:33 +0000 (+0000) Subject: Fixed _Read() when waitall was not set and there was data in the pushback buffer X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5f3629babd86a81f255fc3f22a824841c54e93e8?hp=7b28543293a62af24e1f5e0230cd72b0d852059e Fixed _Read() when waitall was not set and there was data in the pushback buffer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6734 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/socket.cpp b/src/common/socket.cpp index fa5da95246..5036742c4d 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -244,8 +244,13 @@ wxUint32 wxSocketBase::_Read(void* buffer, wxUint32 nbytes) nbytes -= total; buffer = (char *)buffer + total; - // If the socket is invalid or we got all the data, return now - if (!m_socket || !nbytes) + // Return now in one of the following cases: + // - the socket is invalid, + // - we got all the data, + // - we got *some* data and we are not using wxSOCKET_WAITALL. + if ( !m_socket || + !nbytes || + ((total != 0) && !(m_flags & wxSOCKET_WAITALL)) ) return total; // Possible combinations (they are checked in this order)