diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index 8ff6ae67..80f22401 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -1915,8 +1915,6 @@ struct lws { unsigned int user_space_externally_allocated:1; unsigned int socket_is_permanently_unusable:1; unsigned int rxflow_change_to:2; - /* has to live here since ah may stick to end */ - unsigned int more_rx_waiting:1; unsigned int conn_stat_done:1; unsigned int cache_reuse:1; unsigned int cache_revalidate:1; diff --git a/lib/server/parsers.c b/lib/server/parsers.c index d3873039..0da7fb9b 100644 --- a/lib/server/parsers.c +++ b/lib/server/parsers.c @@ -367,10 +367,9 @@ int lws_header_table_detach(struct lws *wsi, int autoservice) */ lwsl_debug("%s: wsi %p: ah held %ds, " "ah.rxpos %d, ah.rxlen %d, mode/state %d %d," - "wsi->more_rx_waiting %d\n", __func__, wsi, + "\n", __func__, wsi, (int)(now - ah->assigned), - ah->rxpos, ah->rxlen, wsi->mode, wsi->state, - wsi->more_rx_waiting); + ah->rxpos, ah->rxlen, wsi->mode, wsi->state); } ah->assigned = 0; diff --git a/lib/server/server.c b/lib/server/server.c index b5176e7c..eb461799 100644 --- a/lib/server/server.c +++ b/lib/server/server.c @@ -1334,8 +1334,6 @@ lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len) } while (len--) { - wsi->more_rx_waiting = !!len; - if (wsi->mode != LWSCM_HTTP_SERVING && wsi->mode != LWSCM_HTTP2_SERVING && wsi->mode != LWSCM_HTTP_SERVING_ACCEPTED) { @@ -1383,8 +1381,6 @@ raw_transition: continue; lwsl_parser("%s: lws_parse sees parsing complete\n", __func__); - lwsl_debug("%s: wsi->more_rx_waiting=%d\n", __func__, - wsi->more_rx_waiting); /* select vhost */ @@ -1743,7 +1739,7 @@ upgrade_ws: wsi->ws->ietf_spec_revision); /* !!! drop ah unreservedly after ESTABLISHED */ - if (!wsi->more_rx_waiting) { + if (wsi->ah->rxpos == wsi->ah->rxlen ) { lws_header_table_force_to_detachable_state(wsi); lws_header_table_detach(wsi, 1); } @@ -1901,10 +1897,7 @@ lws_http_transaction_completed(struct lws *wsi) * reset the existing header table and keep it. */ if (wsi->ah) { - lwsl_debug("%s: wsi->more_rx_waiting=%d\n", __func__, - wsi->more_rx_waiting); - - if (!wsi->more_rx_waiting) { + if (wsi->ah->rxpos == wsi->ah->rxlen && !wsi->preamble_rx) { lws_header_table_force_to_detachable_state(wsi); lws_header_table_detach(wsi, 1); #ifdef LWS_OPENSSL_SUPPORT @@ -2339,15 +2332,11 @@ lws_server_socket_service(struct lws_context *context, struct lws *wsi, ah->rxlen = ah->rxpos = 0; goto try_pollout; } - - /* - * make sure ah does not get detached if we - * have live data in the rx - */ - if (ah->rxlen) - wsi->more_rx_waiting = 1; } + // lwsl_notice("new read, rxpos %d / rxlen %d\n", ah->rxpos, ah->rxlen); + // lwsl_hexdump_level(LLL_NOTICE, ah->rx, ah->rxlen); + if (!(ah->rxpos != ah->rxlen && ah->rxlen)) { lwsl_err("%s: assert: rxpos %d, rxlen %d\n", __func__, ah->rxpos, ah->rxlen);