[PATCH uhttpd rfc] client: really close connection on timeout

Rafał Miłecki zajec5 at gmail.com
Mon Jul 27 14:14:44 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>
---
While this fixes described problem I'm not sure if calling
uh_request_done() is the right thing to do. I need someone with better
uhttpd knowledge to review this.
---
 client.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/client.c b/client.c
index 2a2393f..e933e63 100644
--- a/client.c
+++ b/client.c
@@ -96,6 +96,7 @@ static void client_timeout(struct uloop_timeout *timeout)
 
 	cl->state = CLIENT_STATE_CLOSE;
 	uh_connection_close(cl);
+	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