[Libwebsockets] Use of libwebsockets_serve_http_file()

Mark Hessling mark at rexx.org
Sun Nov 1 04:40:57 CET 2015


On 01/11/15 12:52, Andy Green wrote:
>
> On 1 November 2015 10:36:54 GMT+08:00, Mark Hessling <mark at rexx.org> wrote:
>> Hi Andy,
>>
>> Sorry I couldn't get back to you before now about this issue, but I've
>> been overseas on holiday.
>>
>> I upgraded to v1.5 (from v1.3) and re-built my Rexx interface (with
>> problems which I will document in another email).
>>
>> I am now calling libwebsocket_set_timeout( wsi, NO_PENDING_TIMEOUT, 0 )
>> before each call to libwebsocket_serve_http_file() and the behaviour
>> hasn't changed.  When running on Windows, my LWS server only sends 40k
>> of the larger files when I have throttled the bandwidth.  So, nothing
>> has changed by using the suggestion. 
>>
>> Note that this is only an issue on Windows; on Linux thee is no need
>> for
> Oh... I must have missed that in your email.  If Linux works well then it wouldn't be a bug like that.
>
>> the call to libwebsocket_set_timeout() as the LWS server serves the
>> complete files when throttling the bandwidth.
>>
>> As I've mentioned before this is a very easy problem to replicate by
>> simply serving a file > 40k and using Chrome Developer Tools, throttle
>> the bandwidth to GPRS speeds and the file serving will fail.
> Yes... but all the windows stuff is contributed.
>
> It seems though it's one of
>
>  - the differences in lws-plat-xxx
>
>  - something about windows' not very good WSA or other OS setting / difference
>
>  - the client or some intermediary (pervy windows firewall) times him out
>
> If he times out literally from lws point of view, especially if it happens at 5-6s, you can try changing AWAITING_TIMEOUT in private-libwebsockets.h, eg to 10s.

I changed AWAITING_TIMEOUT to 25 and I no longer have the problem of
served files being truncated.  I'd be happy to help try and fix the
problem in the correct way, but I only just started looking at the
internals of LWS today to see where AWAITING_TIMEOUT is used so not sure
where to start with this.

>
> If the behaviour follows suit, you know clearly that behaviour is somehow related to lws timeout stuff in the library or user code.  If he stays the same, it's still ambiguous.
>
> -Andy
>
>
[snip]

-- 
------------------------------------------------------------------------
* Mark Hessling, mark at rexx.org http://www.rexx.org/
* Author of THE, a Free XEDIT/KEDIT editor and, Rexx/SQL, Rexx/CURL, etc.
* Maintainer of Regina Rexx interpreter
* Use Rexx? join the Rexx Language Association: http://www.rexxla.org/ 
------------------------------------------------------------------------





More information about the Libwebsockets mailing list