non ssl on ssl port zero recv ambiguous
authorAndy Green <andy.green@linaro.org>
Fri, 6 Nov 2015 00:23:05 +0000 (08:23 +0800)
committerAndy Green <andy.green@linaro.org>
Fri, 6 Nov 2015 00:23:05 +0000 (08:23 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/ssl.c

index 0150b15..f4c962f 100644 (file)
--- 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)) {
                                /*