1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

tls: defer listing of pending tls wsi to be managed by tls read only

https://github.com/warmcat/libwebsockets/issues/1920
This commit is contained in:
Andy Green 2020-05-18 06:49:01 +01:00
parent 2c46d3882f
commit 33f8e219eb
3 changed files with 23 additions and 20 deletions

View file

@ -587,18 +587,17 @@ lws_service_flag_pending(struct lws_context *context, int tsi)
if (wsi->position_in_fds_table >= 0) {
pt->fds[wsi->position_in_fds_table].revents |=
pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
if (pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN) {
forced = 1;
/*
* he's going to get serviced now, take him off the
* list of guys with buffered SSL. If he still has some
* at the end of the service, he'll get put back on the
* list then.
*/
__lws_ssl_remove_wsi_from_buffered_list(wsi);
}
pt->fds[wsi->position_in_fds_table].revents |=
pt->fds[wsi->position_in_fds_table].events &
LWS_POLLIN;
if (pt->fds[wsi->position_in_fds_table].revents &
LWS_POLLIN)
/*
* We're not going to remove the wsi from the
* pending tls list. The processing will have
* to do it if he exhausts the pending tls.
*/
forced = 1;
}
} lws_end_foreach_dll_safe(p, p1);

View file

@ -136,10 +136,12 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
if (!wsi->tls.ssl)
goto bail;
if (SSL_pending(wsi->tls.ssl) &&
lws_dll2_is_detached(&wsi->tls.dll_pending_tls))
lws_dll2_add_head(&wsi->tls.dll_pending_tls,
&pt->tls.dll_pending_tls_owner);
if (SSL_pending(wsi->tls.ssl)) {
if (lws_dll2_is_detached(&wsi->tls.dll_pending_tls))
lws_dll2_add_head(&wsi->tls.dll_pending_tls,
&pt->tls.dll_pending_tls_owner);
} else
__lws_ssl_remove_wsi_from_buffered_list(wsi);
return n;
bail:

View file

@ -297,10 +297,12 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
if (!wsi->tls.ssl)
goto bail;
if (SSL_pending(wsi->tls.ssl) &&
lws_dll2_is_detached(&wsi->tls.dll_pending_tls))
lws_dll2_add_head(&wsi->tls.dll_pending_tls,
&pt->tls.dll_pending_tls_owner);
if (SSL_pending(wsi->tls.ssl)) {
if (lws_dll2_is_detached(&wsi->tls.dll_pending_tls))
lws_dll2_add_head(&wsi->tls.dll_pending_tls,
&pt->tls.dll_pending_tls_owner);
} else
__lws_ssl_remove_wsi_from_buffered_list(wsi);
return n;
bail: