From edb92ee3c75fac5e25723d9e4dd6417f02222cb0 Mon Sep 17 00:00:00 2001 From: Justin Chen Date: Thu, 14 Apr 2016 21:42:11 +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 0d850ebe..11f88e82 100644 --- a/lib/output.c +++ b/lib/output.c @@ -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 ||