[Libwebsockets] lws_rx_flow_control problem

Per Bothner per at bothner.com
Tue Oct 10 01:23:57 CEST 2017

For the sake of discussion, DomTerm uses two kinds of wsi/protocols:

- a "pty" wsi wraps the pty of a child process (session).
It is created using lws_adopt_descriptor_vhost.

- a "tty" wsi [awkward name, historical reasons] manages a websocket
between the server and a browser.

Note the "pty" wsi cannot be the "child" of a "tty" wsi, because
a process may be detached, and so have no connected browser windows.
There may also be multiple "tty" connections for a given "pty" if
there are multiple browser windows displaying the same session.

I'd like to be able to use use flow control to suspend a "pty" when there
is no ""tty" ready for more output.  Specifically, to stop polling for
output from the session.  The problem is: how do I reenable output when
a browser session is created or can handle more data?  I can call
               lws_rx_flow_control(pty_wsi, 1);
However, that has no immediate effect - all it does it set
     rxflow_change_to = LWS_RXFLOW_PENDING_CHANGE|1;
The actual update to the pollfd is done by _lws_rx_flow_control.
However, that is never called for the pty wsi - since polling
is suspended and there are no events.  _lws_rx_flow_control
is called for the "tty" wsi - and that will un-suspend its
children - but that doesn't help, since the pty wsi is not a child
and cannot be.
	--Per Bothner
per at bothner.com   http://per.bothner.com/

More information about the Libwebsockets mailing list