client: zero length read indicates peer shutdown
authorAndy Green <andy@warmcat.com>
Sat, 25 Mar 2017 00:47:06 +0000 (08:47 +0800)
committerAndy Green <andy@warmcat.com>
Sat, 25 Mar 2017 00:47:30 +0000 (08:47 +0800)
lib/service.c

index c7bb06f..b742301 100644 (file)
@@ -566,7 +566,10 @@ lws_http_client_read(struct lws *wsi, char **buf, int *len)
                return -1;
        }
 
-       if (rlen <= 0)
+       if (rlen == 0)
+               return -1;
+
+       if (rlen < 0)
                return 0;
 
        *len = rlen;
@@ -1105,7 +1108,7 @@ drain:
                                        wsi->protocol->callback,
                                        wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP,
                                        wsi->user_space, NULL, 0)) {
-                               lwsl_debug("LWS_CALLBACK_RECEIVE_CLIENT_HTTP closed it\n");
+                               lwsl_notice("LWS_CALLBACK_RECEIVE_CLIENT_HTTP closed it\n");
                                goto close_and_handled;
                        }
                }