recv treat zero return as error
authorJustin Chen <justinchen00@github.invalid.com>
Thu, 14 Apr 2016 13:42:11 +0000 (21:42 +0800)
committerAndy Green <andy@warmcat.com>
Thu, 14 Apr 2016 13:42:11 +0000 (21:42 +0800)
https://github.com/warmcat/libwebsockets/issues/475

lib/output.c

index 0d850ebe8e64c615799ed229f1fc6d6b6bbee8a6..11f88e8211d7beaba7268ca5c6fd3e0958c9dd7c 100644 (file)
@@ -622,7 +622,7 @@ lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len)
        int n;
 
        n = recv(wsi->sock, (char *)buf, len, 0);
-       if (n >= 0)
+       if (n > 0)
                return n;
 #if LWS_POSIX
        if (LWS_ERRNO == LWS_EAGAIN ||