[Libwebsockets] output.c

"Andy Green (林安廸)" andy at warmcat.com
Sun Mar 16 01:44:04 CET 2014


On 16/03/14 07:35, the mail apparently from Edward included:
> Hi,
>
>      Thank you for creating the websocket C library and made it available!
>      I think I encounter a possible over sigh in the
> libwebsocket_write() routine, when in case there are a lot of data being
> send out to a non-blocking websocket to cause the it to return "send
> would block", the application then request write notify from the
> websocket, but when the websocket becomes writable, the output would
> cause the remote websocket to close due to an invalid opcode.
>      I reviewed the libwebsocket_write() routine and found the
> wsi->u.ws.inside_frame was left at '1' when any error (including "send
> would block") return from sending and this will cause the next call to
> the libwebsocket_write() with the same wsi to skip calculating the 'pre'
> variable making the incorrect offset for the header and the opcode.
>      I have manually reset the wsi->u.ws.inside_frame to '0' on my
> application when the websocket returns "send would block" and it is now
> working. Just to notify you on what I have found.

It's clear you found some kind of problem and thanks for mailing about it.

But I couldn't really match what you're describing to the code, in terms 
of where it would return WOULDBLOCK... maybe I just missed the point.

Can you give me some more details?  What's the HEAD of libwebsockets 
that you are using?

Are you using SSL?

-Andy

> Thanks again!
> Edward.




More information about the Libwebsockets mailing list