updates.
[silc.git] / lib / silcutil / win32 / silcwin32sockconn.c
index ba8a5d7e14ddc7596acf74fd90c3c8a249dd6e9c..c78640308398c344bde074d1226a055db1d60693 100644 (file)
@@ -41,9 +41,11 @@ int silc_socket_write(SilcSocketConnection sock)
       err = WSAGetLastError();
       if (err == WSAEWOULDBLOCK) {
        SILC_LOG_DEBUG(("Could not write immediately, will do it later"));
+       silc_net_set_socket_nonblock(fd);
        return -2;
       }
       SILC_LOG_ERROR(("Cannot write to socket: %d", (int)fd));
+      silc_net_set_socket_nonblock(fd);
       return -1;
     }
 
@@ -52,6 +54,7 @@ int silc_socket_write(SilcSocketConnection sock)
 
   SILC_LOG_DEBUG(("Wrote data %d bytes", ret));
 
+  silc_net_set_socket_nonblock(fd);
   return ret;
 }
 
@@ -74,12 +77,16 @@ int silc_socket_read(SilcSocketConnection sock)
     err = WSAGetLastError();
     if (err == WSAEWOULDBLOCK || err == WSAEINTR) {
       SILC_LOG_DEBUG(("Could not read immediately, will do it later"));
+      silc_net_set_socket_nonblock(fd);
       return -2;
     }
     SILC_LOG_ERROR(("Cannot read from socket: %d", (int)fd));
+    silc_net_set_socket_nonblock(fd);
     return -1;
   }
 
+  silc_net_set_socket_nonblock(fd);
+
   if (!len)
     return 0;