[Libwebsockets] output.c: lws_issue_raw handle_truncated_send instead of assert(0)

Derald Woods woods.technical at gmail.com
Fri Apr 10 18:21:34 CEST 2015


Hello Andy,

The following patch allows code, that I am working with, to survive browser
refreshes while streaming larger chunks of data (~500k). SSL is enabled on
the connections. I have not observed any side-effects or bad behavior. The
'partial send' actually completes. The application is 'best-effort'
delivery on the network. I am continuing my verifications, but this appears
to do the right thing for my use-case.

Your thoughts? Corrections? Warnings?

---8<-----------------------------------------------------------------------
diff --git a/lib/output.c b/lib/output.c
index b914f28..9e07ae5 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -109,7 +109,8 @@ int lws_issue_raw(struct libwebsocket *wsi, unsigned
char *buf, size_t len)
                 wsi->truncated_send_len +
                 wsi->truncated_send_offset))) {
         lwsl_err("****** %x Sending new, pending truncated ...\n", wsi);
-        assert(0);
+        n = 0;
+        goto handle_truncated_send;
     }

     m = lws_ext_callback_for_each_active(wsi,
---8<-----------------------------------------------------------------------

-- 
Derald
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20150410/efab91ec/attachment.html>


More information about the Libwebsockets mailing list