From 22524a65a23e397ce10904acb4ff6d1fb1f94193 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 15 Feb 2013 22:48:58 +0800 Subject: [PATCH] close if we tried to close politely just close next time Signed-off-by: Andy Green --- lib/libwebsockets.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 74359a2b..3cdc6fa0 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -200,6 +200,10 @@ libwebsocket_close_and_free_session(struct libwebsocket_context *context, if (old_state == WSI_STATE_DEAD_SOCKET) return; + /* we tried the polite way... */ + if (old_state == WSI_STATE_AWAITING_CLOSE_ACK) + goto just_kill_connection; + wsi->u.ws.close_reason = reason; if (wsi->mode == LWS_CONNMODE_HTTP_SERVING && wsi->u.http.fd) {