[Libwebsockets] Truncated send handled by user not working as expected

Andy Green andy at warmcat.com
Mon Aug 18 16:59:43 CEST 2014



On 18 August 2014 22:48:00 GMT+08:00, Roger Light <roger at atchoo.org> wrote:
>Hi Andy,
>
>> For the return value, currently it's defined to tell how much it sent
>(or
>> buffered) or negative for something fatal.
>>
>> Lws is 4 years old now there's a fair amount of user code and all of
>it uses
>> libwebsocket_write(), I think if it changed to, eg, returning a
>negative
>> code for 'I buffered it', which is not an error, it will cause a lot
>of
>> reasonable existing code to break.
>>
>> So I think the next best thing is add a cheap accessor to detect if
>it's
>> still possible to write on the wsi, ie, check if there's an active
>partial
>> buffer.
>
>That sounds ideal to me.

Okie I just pushed these, get rid of the confusing old flag

http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/commit/?id=822241c2a79d05c535dc2c7415fd8345ee72b7fb

And add the accessor

http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/commit/?id=14425eae4ebeffa88630b5a3e4bdb0ea1b4da325

I also changed the relevant part of the test server to use it.

-Andy

>Cheers,
>
>Roger
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list