From bce3f98f1b2fd3ad5cd18b01cbb1e68dc2be29dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Hern=C3=A1ndez?= Date: Thu, 21 Dec 2017 10:06:59 +0100 Subject: [PATCH] Detect dead socket on iOS when server closed connection It aims to solve the ticket issue #1129 (https://github.com/warmcat/libwebsockets/issues/1129). --- lib/ssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ssl.c b/lib/ssl.c index aac1e5633..53fac4f51 100644 --- a/lib/ssl.c +++ b/lib/ssl.c @@ -463,7 +463,7 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len) lwsl_debug("%p: SSL_read says %d\n", wsi, n); /* manpage: returning 0 means connection shut down */ - if (!n) { + if (!n || (n == -1 && errno == ENOTCONN)) { wsi->socket_is_permanently_unusable = 1; return LWS_SSL_CAPABLE_ERROR;