[Libwebsockets] [libwebsockets] #42: calculates number of actually sent bytes incorrectly in libwebsockets_write

Trac trac at libwebsockets.org
Fri Oct 18 00:44:43 CEST 2013

#42: calculates number of actually sent bytes incorrectly in libwebsockets_write
  Reporter:  andreaspakulat          |      Owner:
      Type:  defect                  |     Status:  new
  Priority:  major                   |  Milestone:
 Component:  libwebsocket test apps  |    Version:
Resolution:                          |   Keywords:

Comment (by agreen):

 Replying to [comment:6 andreaspakulat]:
 > Setting rx_buffer_size does not seem to help, note that I'm using lws on
 the server side of things. I'm now setting it to 64K and trying to send
 32K of payload, splitting my actual data using fragments.
 > The first 3-4 websocket frames are smaller than 512 bytes and go across
 without issue. The next one is the 500K frame and handing over the first
 32K of it to lws lets me run into that new code block you added in
 759f4ac4e54642e07c8eabb5cc8c7794fec19b62, i.e. I see "partial send 32772
 sent, 22976 accepted" here.

 I see, from your description that sounds like evidence the SO_SNDBUF
 arrangements are not enough :-/

 What OS are you running on?

 > Just re-sending the first frame seems to confuse the client, which is
 still waiting on the data of the first frame and hence ends up not reading
 any further from the socket which leads to the server not being able to
 write out anything anymore at some point.
 > Not re-sending the first frame leads to the same issue as far as I can

 No you're dead at that point as it stands.

 However as I said if this problem is reproduced I'll do something about it
 at lws level.

Ticket URL: <http://libwebsockets.org/trac/libwebsockets/ticket/42#comment:7>
libwebsockets <http://libwebsockets.org>
libwebsockets C library

More information about the Libwebsockets mailing list