2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

Don't try and reset timers which aren't being used.

This commit is contained in:
Michael Sawyer 2000-07-11 17:35:49 +00:00
parent 5c0a406664
commit 6331b9a45e
2 changed files with 16 additions and 5 deletions

View File

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: dig.c,v 1.57 2000/07/10 18:02:27 bwelling Exp $ */
/* $Id: dig.c,v 1.58 2000/07/11 17:35:48 mws Exp $ */
#include <config.h>
#include <stdlib.h>
@ -644,6 +644,13 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
timeout = atoi(&rv[0][6]);
if (timeout <= 0)
timeout = 1;
debug ("timeout set to %d", timeout);
} else if (strncmp(rv[0], "+timeout=", 9) == 0) {
/* Global option always */
timeout = atoi(&rv[0][9]);
if (timeout <= 0)
timeout = 1;
debug ("timeout set to %d", timeout);
} else if (strncmp(rv[0], "+tries=", 7) == 0) {
if (have_host) {
lookup->retries = atoi(&rv[0][7]);

View File

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: dighost.c,v 1.73 2000/07/10 18:02:28 bwelling Exp $ */
/* $Id: dighost.c,v 1.74 2000/07/11 17:35:49 mws Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
@ -1193,6 +1193,7 @@ send_udp(dig_lookup_t *lookup) {
local_timeout = UDP_TIMEOUT;
} else
local_timeout = timeout;
debug ("have local timeout of %d", local_timeout);
isc_interval_set(&lookup->interval, local_timeout, 0);
result = isc_timer_create(timermgr, isc_timertype_once, NULL,
&lookup->interval, global_task,
@ -1763,19 +1764,21 @@ recv_done(isc_task_t *task, isc_event_t *event) {
* the timeout to much longer, so brief network
* outages won't cause the XFR to abort
*/
if (timeout != INT_MAX) {
if ((timeout != INT_MAX) &&
(query->lookup->timer != NULL)) {
if (timeout == 0) {
if (query->lookup->tcp_mode)
local_timeout = TCP_TIMEOUT;
else
local_timeout = UDP_TIMEOUT;
} else {
if (((long)timeout * 4) <
(long)INT_MAX)
if (timeout < (INT_MAX / 4))
local_timeout = timeout * 4;
else
local_timeout = INT_MAX;
}
debug ("have local timeout of %d",
local_timeout);
isc_interval_set(&query->lookup->interval,
local_timeout, 0);
result = isc_timer_reset(query->lookup->timer,
@ -1953,6 +1956,7 @@ do_lookup_tcp(dig_lookup_t *lookup) {
local_timeout = UDP_TIMEOUT;
} else
local_timeout = timeout;
debug ("have local timeout of %d", local_timeout);
isc_interval_set(&lookup->interval, local_timeout, 0);
result = isc_timer_create(timermgr, isc_timertype_once, NULL,
&lookup->interval, global_task,