ah pool lifetime use dynamic rxpos
authorAndy Green <andy.green@linaro.org>
Sat, 20 Feb 2016 00:04:09 +0000 (08:04 +0800)
committerAndy Green <andy.green@linaro.org>
Sat, 20 Feb 2016 00:04:09 +0000 (08:04 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/parsers.c
lib/server.c

index 971cdd6..2547ec9 100644 (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);
index 26daa96..cc846d4 100644 (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);
        }