ah pool lifetime use dynamic rxpos

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2016-02-20 08:04:09 +08:00
parent 1610223737
commit 3310dd19b5
2 changed files with 16 additions and 6 deletions

View file

@ -190,7 +190,7 @@ int lws_header_table_detach(struct lws *wsi)
pwsi = &pt->ah_wait_list;
if (!ah) { /* remove from wait list if that's all */
if (wsi->socket_is_permanently_unusable)
// if (wsi->socket_is_permanently_unusable)
while (*pwsi) {
if (*pwsi == wsi) {
lwsl_info("%s: wsi %p, remv wait\n",
@ -206,9 +206,18 @@ int lws_header_table_detach(struct lws *wsi)
goto bail;
}
time(&now);
if (now - wsi->u.hdr.ah->assigned > 3)
lwsl_notice("header assign - free time %d\n",
(int)(now - wsi->u.hdr.ah->assigned));
if (now - wsi->u.hdr.ah->assigned > 3) {
/*
* we're detaching the ah, but it was held an
* unreasonably long time
*/
lwsl_notice("%s: wsi %p: ah held %ds, "
"ah.rxpos %d, ah.rxlen %d, mode/state %d %d,"
"wsi->more_rx_waiting %d\n", __func__, wsi,
(int)(now - wsi->u.hdr.ah->assigned),
ah->rxpos, ah->rxlen, wsi->mode, wsi->state,
wsi->u.hdr.more_rx_waiting);
}
/* if we think we're detaching one, there should be one in use */
assert(pt->ah_count_in_use > 0);

View file

@ -739,9 +739,10 @@ lws_http_transaction_completed(struct lws *wsi)
* reset the existing header table and keep it.
*/
if (wsi->u.hdr.ah) {
if (wsi->u.hdr.ah->rxpos == wsi->u.hdr.ah->rxlen)
if (!wsi->u.hdr.more_rx_waiting) {
wsi->u.hdr.ah->rxpos = wsi->u.hdr.ah->rxlen;
lws_header_table_detach(wsi);
else
} else
lws_header_table_reset(wsi);
}