From 6406f44b76949dc6c9ad78cd78abe297f1b06db1 Mon Sep 17 00:00:00 2001 From: Justin Chen Date: Thu, 14 Apr 2016 21:42:25 +0800 Subject: [PATCH] recv treat zero return as error https://github.com/warmcat/libwebsockets/issues/475 --- lib/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/output.c b/lib/output.c index a0977458..8829840f 100644 --- a/lib/output.c +++ b/lib/output.c @@ -576,7 +576,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 ||