From 6dd7e86f23b75cbef5c4d04f8b85c32ef1fb9643 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 29 Jan 2016 09:06:22 +0800 Subject: [PATCH] http1.1 keepalive drop ah betweentimes https://github.com/warmcat/libwebsockets/issues/404 Tested with wget -O- http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html and confirm no connection processing during that on server side Signed-off-by: Andy Green --- lib/server.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/server.c b/lib/server.c index 564a2c47..2009bf10 100644 --- a/lib/server.c +++ b/lib/server.c @@ -691,8 +691,11 @@ lws_http_transaction_completed(struct lws *wsi) /* He asked for it to stay alive indefinitely */ lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0); - if (lws_allocate_header_table(wsi)) - lwsl_info("On waiting list for header table"); + /* if we still have the headers, drop them and reacquire a new ah when + * the new headers arrive. Otherwise we hog an ah indefinitely, + * needlessly. + */ + lws_free_header_table(wsi); /* If we're (re)starting on headers, need other implied init */ wsi->u.hdr.ues = URIES_IDLE;