Skip second termiantion if there is already a termination event in progress. This has been observed with clients clsoing their connection exactly at the same time when dnsmasq wants to close the connection itself due to a timeout (it thinks this client is stale).

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-07-17 12:04:35 +02:00
parent 4b9eeb83ec
commit f07f0dfaac
+9
View File
@@ -1785,8 +1785,17 @@ static void prepare_blocking_metadata(void)
// Called when a (forked) TCP worker is terminated by receiving SIGALRM
// We close the dedicated database connection this client had opened
// to avoid dangling database locks
static volatile bool worker_already_terminating = false;
void FTL_TCP_worker_terminating(bool finished)
{
if(worker_already_terminating)
{
logg("TCP worker already terminating!");
return;
}
worker_already_terminating = true;
// Possible debug logging
if(config.debug != 0)
{
const char *reason = finished ? "client disconnected" : "timeout";