From a97604737b4c25b8b72b0bbf9b6ea16f98bfec15 Mon Sep 17 00:00:00 2001 From: George Thessalonikefs Date: Tue, 11 Jan 2022 10:00:04 +0100 Subject: [PATCH] - Fix prematurely terminated TCP queries when a reply has the same ID. --- doc/Changelog | 3 +++ services/outside_network.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index 1c88f9724..586cd1c37 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +11 January 2022: George + - Fix prematurely terminated TCP queries when a reply has the same ID. + 7 January 2022: Wouter - Merge #600 from pemensik: Change file mode before changing file owner. diff --git a/services/outside_network.c b/services/outside_network.c index f4a5d0707..d2389dd2d 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -1248,6 +1248,12 @@ outnet_tcp_cb(struct comm_point* c, void* arg, int error, c->buffer)); /* find the query the reply is for */ w = reuse_tcp_by_id_find(&pend->reuse, id); + /* Make sure that the reply we got is at least for a + * sent query with the same ID; the waiting_tcp that + * gets a reply is assumed to not be waiting to be + * sent. */ + if(w && (w->on_tcp_waiting_list || w->write_wait_queued)) + w = NULL; } } if(error == NETEVENT_NOERROR && !w) {