Don't retry +tcp queries on failure if tries=1 or retries=0

Before this commit, a premature EOF (connection closed) on tcp queries
was causing dig to automatically attempt to send the query again, even
if +tries=1 or +retries=0 was provided on command line.

This commit fix the problem by taking into account the no. of retries
specified by the user when processing a premature EOF on tcp
connections.
This commit is contained in:
Diego Fronza
2021-02-15 19:28:50 -03:00
parent b813eab387
commit 1e5f3e6fa3

View File

@@ -3079,7 +3079,8 @@ connect_timeout(isc_task_t *task, isc_event_t *event) {
*/
static void
requeue_or_update_exitcode(dig_lookup_t *lookup) {
if (lookup->eoferr == 0U) {
if (lookup->eoferr == 0U && lookup->retries > 1) {
--lookup->retries;
/*
* Peer closed the connection prematurely for the first time
* for this lookup. Try again, keeping track of this failure.