From b3f852776022d0998bc04e093200bed0e117ec64 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 28 Jan 2013 17:20:41 +0800 Subject: [PATCH] timeout coverage for ssl accept Signed-off-by: Andy Green --- lib/private-libwebsockets.h | 1 + lib/server.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index b34e840..ee5f175 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -267,6 +267,7 @@ enum pending_timeout { PENDING_TIMEOUT_CLOSE_ACK, PENDING_TIMEOUT_AWAITING_EXTENSION_CONNECT_RESPONSE, PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE, + PENDING_TIMEOUT_SSL_ACCEPT, }; diff --git a/lib/server.c b/lib/server.c index 5fdccbb..03c0a26 100644 --- a/lib/server.c +++ b/lib/server.c @@ -291,6 +291,9 @@ int lws_server_socket_service(struct libwebsocket_context *context, wsi->mode = LWS_CONNMODE_SSL_ACK_PENDING; insert_wsi_socket_into_fds(context, wsi); + libwebsocket_set_timeout(wsi, PENDING_TIMEOUT_SSL_ACCEPT, + AWAITING_TIMEOUT); + lwsl_info("inserted SSL acceipt into fds, trying actual SSL_accept\n"); /* fallthru */ @@ -340,6 +343,8 @@ int lws_server_socket_service(struct libwebsocket_context *context, /* OK, we are accepted */ + libwebsocket_set_timeout(wsi, NO_PENDING_TIMEOUT, 0); + wsi->mode = LWS_CONNMODE_HTTP_SERVING; lwsl_debug("accepted new SSL conn " -- 2.7.4