From bb90f9b7e6dec813d1cd4727aaae66ebc6a414c7 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 16 Apr 2015 19:55:42 +0800 Subject: [PATCH] client error on timeout before connection Signed-off-by: Andy Green --- lib/libwebsockets.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 8086913d..c2d917d8 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -256,8 +256,14 @@ just_kill_connection: lwsl_debug("calling back CLOSED_HTTP\n"); context->protocols[0].callback(context, wsi, LWS_CALLBACK_CLOSED_HTTP, wsi->user_space, NULL, 0 ); + } else if (wsi->mode == LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY) { + lwsl_debug("Connection closed before server reply\n"); + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_CLIENT_CONNECTION_ERROR, + wsi->user_space, NULL, 0 ); } else - lwsl_debug("not calling back closed\n"); + lwsl_debug("not calling back closed mode=%d state=%d\n", + wsi->mode, old_state); /* deallocate any active extension contexts */