Fix the intermittent fault in the socket layer that was occasionally
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 5 Sep 2001 22:04:19 +0000 (22:04 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 5 Sep 2001 22:04:19 +0000 (22:04 +0000)
bombing out X forwarding. It turns out to be a workaround for YET
ANOTHER useless WinSock implementation. Arrgh!

git-svn-id: svn://svn.tartarus.org/sgt/putty@1232 cda61777-01e9-0310-a592-d414129be87e

winnet.c

index 40f416d..1a80a80 100644 (file)
--- a/winnet.c
+++ b/winnet.c
@@ -718,14 +718,15 @@ void try_send(Actual_Socket s)
        noise_ultralight(nsent);
        if (nsent <= 0) {
            err = (nsent < 0 ? WSAGetLastError() : 0);
-           if ((err == 0 && nsent < 0) || err == WSAEWOULDBLOCK) {
+           if ((err < WSABASEERR && nsent < 0) || err == WSAEWOULDBLOCK) {
                /*
                 * Perfectly normal: we've sent all we can for the moment.
                 * 
-                * (Apparently some WinSocks can return <0 but
-                * leave no error indication - WSAGetLastError() is
-                * called but returns zero - so we check that case
-                * and treat it just like WSAEWOULDBLOCK.)
+                * (Some WinSock send() implementations can return
+                * <0 but leave no sensible error indication -
+                * WSAGetLastError() is called but returns zero or
+                * a small number - so we check that case and treat
+                * it just like WSAEWOULDBLOCK.)
                 */
                s->writable = FALSE;
                return;