[Libwebsockets] Next lws release coming up
andy at warmcat.com
Thu Apr 26 03:32:23 CEST 2018
On 04/26/2018 05:55 AM, Per Bothner wrote:
> On 04/25/2018 09:33 AM, Per Bothner wrote:
>> On 04/25/2018 12:57 AM, Andy Green wrote:
>>> It would be great if lws users confirm current master against their
>>> codebase and let me know about any problems.
>> Just a heads up (or down): I did a pull and re-build (with cmake
>> -DLWS_WITH_SSL=0 -DLWS_WITH_ZIP_FOPS=1 ..).
>> And DomTerm fails miserably.
>> I've started investigating, but just barely.
> Looks like this is the commit that broke DomTerm:
> commit 8f19a3fa9a96ec5dc72eb04e28679e19c0283ce4
> Author: Andy Green <andy at warmcat.com>
> Date: Thu Mar 29 13:32:33 2018 +0800
> network interface: defer bindings to absent network interfaces
> Previously down network interfaces without an IPv4 address are
> removed from the posix api that lists network interfaces.
> That means if you bound a vhost listen socket to a particular
> interface, it will fail at startup time.
> This patch adds these vhosts to a list, starts the vhost without
> a listen socket, and checks to see if the vhost's network interface
> has appeared while the rest of lws is running.
> If it appears, the listen socket is opened on the network interface
> and the vhost becomes reachable.
> Next step is to compare log messages with and without the patch to
> better see where the "hang" is, and also see if I can understand what
> the commit does.
Thanks a lot for checking.
I got private mail from a user on a multiple-interface embedded device,
he was using lwsws and found that if he didn't have a network cable in
one of the interfaces he was binding to, then lwsws would fail out
saying the interface didn't exist.
But asking him about ifconfig -a, the interface logically existed.
After a while I tried to reproduce and realized it's generally true on
Linux, you can't bind to an interface actually, you can only bind to an
IP on the interface. After a few seconds with the ethernet cable out,
something (NetworkManager?) notices the change of state and removes the
IP from the interface making it unbindable.
This patch treats it as nonfatal that the listen socket creation failed,
and puts it on a list for ongoing retry (the rest of the vhost is
created). It repeats the attempt periodically and creates the listen
socket if it becomes possible. Once it has been bound to the right IP,
it stays bound, and if the interface's IP is lost again it will just
wait until it comes back and continue operation without lws having to do
This works well on desktop Linux and solved the reporter's problems,
lwsws will always start and configure itself when or if possible to bind
to the interface.
I don't know why it would break domterm but there should be copious
logging about it.
More information about the Libwebsockets