fixes for close flush
authorAndy Green <andy.green@linaro.org>
Thu, 10 Apr 2014 09:06:59 +0000 (17:06 +0800)
committerAndy Green <andy.green@linaro.org>
Thu, 10 Apr 2014 09:06:59 +0000 (17:06 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/output.c
lib/service.c

index b235954..28e15a6 100644 (file)
@@ -153,9 +153,10 @@ handle_truncated_send:
                        lwsl_info("***** %x partial send completed\n", wsi);
                        /* done with it, but don't free it */
                        n = real_len;
-                       if (wsi->state == WSI_STATE_FLUSHING_STORED_SEND_BEFORE_CLOSE)
+                       if (wsi->state == WSI_STATE_FLUSHING_STORED_SEND_BEFORE_CLOSE) {
                                lwsl_info("***** %x signalling to close now\n", wsi);
                                return -1; /* retry closing now */
+                       }
                }
                /* always callback on writeable */
                libwebsocket_callback_on_writable(
index 85b6753..9aa743e 100644 (file)
@@ -42,7 +42,12 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context,
                }
                /* leave POLLOUT active either way */
                return 0;
-       }
+       } else
+               if (wsi->state == WSI_STATE_FLUSHING_STORED_SEND_BEFORE_CLOSE) {
+                       lwsl_info("***** %x signalling to close in POLLOUT handler\n", wsi);
+                       return -1; /* retry closing now */
+               }
+
 
        m = lws_ext_callback_for_each_active(wsi, LWS_EXT_CALLBACK_IS_WRITEABLE,
                                                                       NULL, 0);