From: Wouter Wijngaards Date: Wed, 15 Jun 2016 14:23:43 +0000 (+0000) Subject: - TCP_TIMEOUT is specified in milliseconds. X-Git-Tag: release-1.5.10~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2121961929aaa7fbca4c71c506b235ba48a88141;p=thirdparty%2Funbound.git - TCP_TIMEOUT is specified in milliseconds. git-svn-id: file:///svn/unbound/trunk@3793 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/remote.h b/daemon/remote.h index b25bfb1af..190286d47 100644 --- a/daemon/remote.h +++ b/daemon/remote.h @@ -56,8 +56,8 @@ struct comm_reply; struct comm_point; struct daemon_remote; -/** number of seconds timeout on incoming remote control handshake */ -#define REMOTE_CONTROL_TCP_TIMEOUT 120 +/** number of milliseconds timeout on incoming remote control handshake */ +#define REMOTE_CONTROL_TCP_TIMEOUT 120000 /** * a busy control command connection, SSL state diff --git a/doc/Changelog b/doc/Changelog index 1db81a4db..a46715a89 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +15 June 2016: Wouter + - TCP_TIMEOUT is specified in milliseconds. + 14 June 2016: Ralph - QNAME minimisation unit test for dropped QTYPE=A queries. diff --git a/util/netevent.c b/util/netevent.c index bdb357393..03a752db3 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -80,8 +80,8 @@ # endif #endif -/** The TCP reading or writing query timeout in seconds */ -#define TCP_QUERY_TIMEOUT 120 +/** The TCP reading or writing query timeout in milliseconds */ +#define TCP_QUERY_TIMEOUT 120000 #ifndef NONBLOCKING_IS_BROKEN /** number of UDP reads to perform per read indication from select */ @@ -2009,7 +2009,7 @@ comm_point_stop_listening(struct comm_point* c) } void -comm_point_start_listening(struct comm_point* c, int newfd, int sec) +comm_point_start_listening(struct comm_point* c, int newfd, int msec) { verbose(VERB_ALGO, "comm point start listening %d", c->fd==-1?newfd:c->fd); @@ -2017,7 +2017,7 @@ comm_point_start_listening(struct comm_point* c, int newfd, int sec) /* no use to start listening no free slots. */ return; } - if(sec != -1 && sec != 0) { + if(msec != -1 && msec != 0) { if(!c->timeout) { c->timeout = (struct timeval*)malloc(sizeof( struct timeval)); @@ -2028,8 +2028,8 @@ comm_point_start_listening(struct comm_point* c, int newfd, int sec) } ub_event_add_bits(c->ev->ev, UB_EV_TIMEOUT); #ifndef S_SPLINT_S /* splint fails on struct timeval. */ - c->timeout->tv_sec = sec; - c->timeout->tv_usec = 0; + c->timeout->tv_sec = msec/1000; + c->timeout->tv_usec = msec%1000; #endif /* S_SPLINT_S */ } if(c->type == comm_tcp) { @@ -2049,7 +2049,7 @@ comm_point_start_listening(struct comm_point* c, int newfd, int sec) c->fd = newfd; ub_event_set_fd(c->ev->ev, c->fd); } - if(ub_event_add(c->ev->ev, sec==0?NULL:c->timeout) != 0) { + if(ub_event_add(c->ev->ev, msec==0?NULL:c->timeout) != 0) { log_err("event_add failed. in cpsl."); } } diff --git a/util/netevent.h b/util/netevent.h index bdcddd848..b902ab3be 100644 --- a/util/netevent.h +++ b/util/netevent.h @@ -496,9 +496,10 @@ void comm_point_stop_listening(struct comm_point* c); * Start listening again for input on the comm point. * @param c: commpoint to enable again. * @param newfd: new fd, or -1 to leave fd be. - * @param sec: timeout in seconds, or -1 for no (change to the) timeout. + * @param msec: timeout in milliseconds, or -1 for no (change to the) timeout. + * So seconds*1000. */ -void comm_point_start_listening(struct comm_point* c, int newfd, int sec); +void comm_point_start_listening(struct comm_point* c, int newfd, int msec); /** * Stop listening and start listening again for reading or writing.