[PATCH uhttpd] client: really close connection on timeout
Rafał Miłecki
zajec5 at gmail.com
Wed Sep 23 06:43:27 EDT 2020
From: Rafał Miłecki <rafal at milecki.pl>
After specified time of network inactivity uhttpd is meant to close
connection. It doesn't seem to work thought. After timeout client
doesn't receive any more data but connection it still opened.
This change fixes that.
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
V1: Set cl->request.connection_close and then call uh_request_done().
With this change:
1. uh_request_done() will take care of calling uh_connection_close()
2. uh_request_done() won't set state back to the CLIENT_STATE_INIT
---
client.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/client.c b/client.c
index 2a2393f..b5736e4 100644
--- a/client.c
+++ b/client.c
@@ -95,7 +95,8 @@ static void client_timeout(struct uloop_timeout *timeout)
struct client *cl = container_of(timeout, struct client, timeout);
cl->state = CLIENT_STATE_CLOSE;
- uh_connection_close(cl);
+ cl->request.connection_close = true;
+ uh_request_done(cl);
}
static void uh_set_client_timeout(struct client *cl, int timeout)
--
2.27.0
More information about the openwrt-devel
mailing list