close if we tried to close politely just close next time 10/3110/1
authorAndy Green <andy.green@linaro.org>
Fri, 15 Feb 2013 14:48:58 +0000 (22:48 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:36 +0000 (13:01 -0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/libwebsockets.c

index 74359a2..3cdc6fa 100644 (file)
@@ -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) {