]> git.saurik.com Git - wxWidgets.git/commitdiff
don't handle orderly socket shutdown by the peer as an error (patch 1688222)
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 30 Mar 2007 19:02:30 +0000 (19:02 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 30 Mar 2007 19:02:30 +0000 (19:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/unix/gsocket.cpp

index b4178c01a5a3d938eadaad58cd9d7fffada840ea..dc0d82cff79b2bd75ed45f5d7c2b9f37aa65501f 100644 (file)
@@ -116,6 +116,10 @@ wxMSW:
 2.8.4
 -----
 
+All (Unix):
+
+- Handle socket shutdown by the peer correctly in wxSocket (Tim Kosse)
+
 wxMSW:
 
 - Corrected wxStaticBox label appearance when its foreground colour was set:
index eeee3fa8cca875d04ede6be217549614574a471a..659f709be5df20151d0fda6af08d6c4ca57a8df2 100644 (file)
@@ -1168,17 +1168,16 @@ int GSocket::Read(char *buffer, int size)
     else
       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
      * socket only if errno does _not_ indicate that there may be more data to read.
      */
     if (ret == 0)
     {
-      m_error = GSOCK_IOERR;
+      /* Make sure wxSOCKET_LOST event gets sent and shut down the socket */
       m_detected = GSOCK_LOST_FLAG;
-      Close();
-      // Signal an error for return
-      return -1;
+      Detected_Read();
+      return 0;
     }
     else if (ret == -1)
     {