don't handle orderly socket shutdown by the peer as an error (patch 1688222) [backport from HEAD]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-30 19:04:25 +00:00
parent beb4cfa4c8
commit 5f814f27d9
2 changed files with 8 additions and 5 deletions

View File

@@ -91,6 +91,10 @@ Major new features in 2.8 release
2.8.4 2.8.4
----- -----
All (Unix):
- Handle socket shutdown by the peer correctly in wxSocket (Tim Kosse)
wxMSW: wxMSW:
- Corrected wxStaticBox label appearance when its foreground colour was set: - Corrected wxStaticBox label appearance when its foreground colour was set:

View File

@@ -1168,17 +1168,16 @@ int GSocket::Read(char *buffer, int size)
else else
ret = Recv_Dgram(buffer, size); ret = Recv_Dgram(buffer, size);
/* If recv returned zero, then the connection is lost, and errno is not set. /* If recv returned zero, then the connection has been gracefully closed.
* Otherwise, recv has returned an error (-1), in which case we have lost the * Otherwise, recv has returned an error (-1), in which case we have lost the
* socket only if errno does _not_ indicate that there may be more data to read. * socket only if errno does _not_ indicate that there may be more data to read.
*/ */
if (ret == 0) if (ret == 0)
{ {
m_error = GSOCK_IOERR; /* Make sure wxSOCKET_LOST event gets sent and shut down the socket */
m_detected = GSOCK_LOST_FLAG; m_detected = GSOCK_LOST_FLAG;
Close(); Detected_Read();
// Signal an error for return return 0;
return -1;
} }
else if (ret == -1) else if (ret == -1)
{ {