reflect send completeness in lws_write return 47/3147/1
authorAndy Green <andy.green@linaro.org>
Sat, 23 Feb 2013 02:50:10 +0000 (10:50 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:38 +0000 (13:01 -0800)
commit12d09ef7db156ee7c2bb9872705198c16e31c041
tree2e3a77a558046abf79e1136d8a6ba91f8dba863d
parent2174ff7dd6e856f0bc2dccdbdf346d1decc6cf26
reflect send completeness in lws_write return

under load, writing packet sizes to the socket that are normally fine
can do partial writes, eg asking to write 4096 may only take 2800 of
it and return 2800 from the actual send.

Until now lws assumed that if it was safe to send, it could take any
size buffer, that's not the case under load.

This patch changes lws_write to return the amount actually taken...
that and the meaning of it becomes tricky when dealing with
compressed links, the amount taken and the amount sent differ.  Also
there is no way to recover at the moment from a protocol-encoded
frame only being partially accepted... however for http file send
content it can and does recover now.

Small frames don't have to take any care about it but large atomic
sends (> 2K) have been seen to fail under load.

Signed-off-by: Andy Green <andy.green@linaro.org>
12 files changed:
changelog
lib/client-parser.c
lib/libwebsockets.c
lib/output.c
lib/parsers.c
lib/server-handshake.c
libwebsockets-api-doc.html
test-server/test-client.c
test-server/test-echo.c
test-server/test-fraggle.c
test-server/test-ping.c
test-server/test-server.c