From 92f0200204e5f60acf1c924ee62c6314c8cf47a2 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 25 Mar 2017 08:47:06 +0800 Subject: [PATCH] client: zero length read indicates peer shutdown --- lib/service.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/service.c b/lib/service.c index c7bb06fb..b7423014 100644 --- a/lib/service.c +++ b/lib/service.c @@ -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; } }