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 c7bb06fb167f09bf14169cb0c3f1368e4913613d..b7423014a9c732ca97a531069d232f032e26f13f 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;
                        }
                }