[Libwebsockets] Restarting lwsws server

Andy Green andy at warmcat.com
Thu Sep 2 20:50:18 CEST 2021



On 9/2/21 12:00 AM, Steve Calfee wrote:
> Hi,
> 
> I am hacking on some html. I copy it into the libwebsockets-test-server 
> root and then send on linux mint: "sudo killall -HUP lwsws" On firefox I 
> then do a reload of the tab. The new html gets there fine.
> 
> But it also spawns a couple new lwsws processes. I thought the -HUP 
> would cause the original processes to vanish. What determines a "end of 
> connection", apparently not a reload?

The SIGHUP strips the old instance of its listen sockets, and they are 
acquired by the new instance successfully.  The new instance comes up 
with whatever changes are in the config now, without any reference to 
the old instance.

When the number of active wsi on the old instance goes to zero, the 
instance that has been "deprecated" like that should exit automatically.

It's like that so that existing, eg, ws connections can continue on 
until they die out naturally, but all new connections will be handled by 
the newly started instance.

I did this a few years ago, a lot has changed about how wsi are handled 
since then, I guess it doesn't correctly discover when the last wsi is 
closed for that purpose atm.

-Andy


More information about the Libwebsockets mailing list