network: add timeout for client connections

Somtimes client connetions will not close therfore add a timeout. Add a
new timer that checks every 5s if we did not receive anything from a
client for (default) 60s. Can be configured via client_timeout.

Code is based on the work of ptpt52.

Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
Nick Hainke 2022-07-20 13:30:00 +02:00 committed by Chen Minqiang
parent e596ff1317
commit 4fa5bc2e37
8 changed files with 50 additions and 0 deletions

View file

@ -79,6 +79,7 @@ struct time_config_s uci_get_time_config() {
.update_tcp_con = 10,
.update_chan_util = 5,
.update_beacon_reports = 20,
.client_timeout = 60,
};
dawnlog_debug_func("Entering...");
@ -105,6 +106,8 @@ struct time_config_s uci_get_time_config() {
DAWN_SET_CONFIG_TIME(ret, s, update_chan_util);
//CONFIG-T: update_beacon_reports|Timer to ask all connected clients for a new BEACON REPORT|[20]
DAWN_SET_CONFIG_TIME(ret, s, update_beacon_reports);
//CONFIG-T: client_timeout|Timespan to check if a client timed out|[60]
DAWN_SET_CONFIG_TIME(ret, s, client_timeout);
return ret;
}
}