[Libwebsockets] lws + libuv ( mac/freebsd ), explicit_vhosts

Andy Green andy at warmcat.com
Tue Nov 29 12:49:09 CET 2016


On Tue, 2016-11-29 at 12:36 +0100, Denis Osvald wrote:
> Hi Andy,
> 
> On 2016-11-29 12:27, Andy Green wrote:
> > A proper "reload" type functionality would also need to deal with
> > killing or modifying vhosts too.  But anyway the bottom line is if
> > you
> > add a vhost later - much later - with libuv, you must do what
> > lws_uv_initloop() does to vhost listen sockets to the new guy's
> > vhost
> > listen socket.  That's the only limitation I think.
> 
> Just checking, with lws I shouldn't encounter any problems with
> live-reloading vhosts when not using libuv, right? Namely, I'd be
> doing
> it with the extpoll support?

This "libuvification" / deferred listen socket instantiation thing is
just for libuv, yes.  It's related to libuv mode not directly using
socket fds and POSIX stuff directly, it has to instantiate libuv
generic "listener" wrappers for the socket to get libuv events.  And
that requires libuv to be in a state that it may not actually be in
until after we finished creating vhosts.  So it is deferred.

But today, lws doesn't have any support for "reload" type
functionality.  I think Aleksey doesn't actually care about that in the
service reload sense, he just wants to add vhosts.

If you want to add vhosts later, you also need to do what is currently
general one-time vhost init in ./lib/context.c lws_protocol_init(). 
This is responsible for making ordered per-vhost protocol lists that
contain both the user protocol list and any plugin protocols attached
to the vhost.

That'll also need the modification treatment where it can be called
again after any subsequent vhost addition before this random vhost
addition stuff will work.

-Andy

> 
> Thanks,
> 
> Denis
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets



More information about the Libwebsockets mailing list