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

ws: LCCSCF_PRIORITIZE_READS

This commit is contained in:
Andy Green 2020-08-23 10:05:40 +01:00
parent fe7fdef9be
commit fa78129f73
2 changed files with 18 additions and 0 deletions

View file

@ -61,6 +61,17 @@ enum lws_client_connect_ssl_connection_flags {
LCCSCF_H2_PRIOR_KNOWLEDGE = (1 << 18),
LCCSCF_WAKE_SUSPEND__VALIDITY = (1 << 19),
/* our validity checks are important enough to wake from suspend */
LCCSCF_PRIORITIZE_READS = (1 << 20),
/**<
* Normally lws balances reads and writes on all connections, so both
* are possible even on busy connections, and we go around the event
* loop more often to facilitate that, even if there is pending data.
*
* This flag indicates that you want to handle any pending reads on this
* connection without yielding the service loop for anything else. This
* means you may block other connection processing in favour of incoming
* data processing on this one if it receives back to back incoming rx.
*/
};
/** struct lws_client_connect_info - parameters to connect with when using

View file

@ -1209,6 +1209,13 @@ drain:
}
pending = lws_ssl_pending(wsi);
#if defined(LWS_WITH_CLIENT)
if (!pending && (wsi->flags & LCCSCF_PRIORITIZE_READS) &&
lws_buflist_total_len(&wsi->buflist))
pending = 9999999;
#endif
if (pending) {
if (lws_is_ws_with_ext(wsi))
pending = pending > wsi->ws->rx_ubuf_alloc ?