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 */