don't handle orderly socket shutdown by the peer as an error (patch 1688222)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-30 19:02:30 +00:00
parent 854386fd92
commit f4854380c1
2 changed files with 8 additions and 5 deletions

View File

@@ -116,6 +116,10 @@ wxMSW:
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)
{ {