[Libwebsockets] SSL http client stalls on the last chunk.

Zevv libws at zevv.nl
Wed Jan 22 15:43:13 CET 2020

Quoting Zevv (2020-01-22 15:25:25)
> Quoting Andy Green (2020-01-22 14:00:30)
> > What happens if we don't rely on having read up to the max result buffer 
> > to trigger checking SSL_pending()?

Your explanation was helpful. No conclusions on the exact how and why,
but some more details I see:

- The bulk of the SSL data is read and all callbacks are processed

- The last chunk still sits there, so the connection gets added to
  the dll_pending_tls list

- The libev idle handler triggers, causing the work to be picked up 
  through _lws_plat_service_forced_tsi and lws_service_flag_pending.
  At the end of the idle hander the idle callback is disabled with

- The one-but-last SSL chunk is handled. Again the connection gets added
  to the dll_pending_tls list. However, the ev_idle handle is no longer
  running so this does not picked up until something happens on one of
  the registered fds.

So I guess I will need to find a way to let _lws_plat_service_forced_tsi
signal the lws_ev_idle_cb it wants the idle callback rescheduled.

More information about the Libwebsockets mailing list