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

Derald Woods woods.technical at gmail.com
Tue Apr 14 17:53:43 CEST 2015


I just saw your detailed response on the web version of the mailing list.
It never reached my Gmail inbox. Thanks for the response.

> Something else is wrong if you end up there... basically while you have a
truncated send pending, there should be no way to send something new.


> The code in the service loop enforces that; it won't call back as
writeable while a truncated send is pending.  And you should only be
sending something new (ending up at lws_issue_raw) in the writeable


> You are illegally sending something new outside of the writeable
callback?  Or the library itself has a problem with its enforcement (I
would have expected to get more complaints about hitting the assert...)

Ah! I have a couple of flags, in my callback, that can lead to incomplete
'attempts' at transferring the data. These look like the cause of my
problems. I will craft some tests without these flags.

Thanks again.

On Fri, Apr 10, 2015 at 11:21 AM, Derald Woods <woods.technical at gmail.com>

> 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

Derald D. Woods
[Ecclesiastes 12:13] "...: Fear God, and keep his commandments: for this is
the whole duty of man."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20150414/a39f658e/attachment-0001.html>

More information about the Libwebsockets mailing list