[9.18] fix handling of TCP timeouts

Evan Hunt requested to merge 4072-tcp-dispatch-timeout-bind-9.18 into bind-9.18

when a TCP dispatch times out, we call tcp_recv() with a result value of ISC_R_TIMEDOUT; this cancels the oldest dispatch entry in the dispatch's active queue, plus any additional entries that have waited longer than their configured timeouts. if, at that point, there were more dispatch entries still on the active queue, it resumes reading, but until now it failed to restart the timer.

this has been corrected: we now calculate a new timeout based on the oldest dispatch entry still remaining. this requires us to initialize the start time of each dispatch entry when it's first added to the queue.

in order to ensure that the handling of timed-out requests is consistent, we now calculate the runtime of each dispatch entry based on the same value for 'now'.

incidentally also fixed a compile error that turned up when DNS_DISPATCH_TRACE was turned on.

(cherry picked from commit 0e800467)

Backport of MR !7937 (merged)

Edited by Evan Hunt

Merge request reports