From 79a3c5d4253dc56ca5e9a7acfad58ac9372b418c Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 6 Nov 2015 08:23:05 +0800 Subject: [PATCH] non ssl on ssl port zero recv ambiguous Signed-off-by: Andy Green --- lib/ssl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ssl.c b/lib/ssl.c index 0150b15f..f4c962f9 100644 --- a/lib/ssl.c +++ b/lib/ssl.c @@ -633,8 +633,12 @@ lws_server_socket_service_ssl(struct libwebsocket_context *context, wsi->ssl = NULL; goto accepted; } - if (!n) /* connection is gone */ - goto fail; + if (!n) /* + * connection is gone, or nothing to read + * if it's gone, we will timeout on + * PENDING_TIMEOUT_SSL_ACCEPT + */ + break; if (n < 0 && (LWS_ERRNO == LWS_EAGAIN || LWS_ERRNO == LWS_EWOULDBLOCK)) { /*