From 61b9ea24a8e1bf912e43ab2a303a11c3bbc8fd51 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 16 Jun 2016 07:21:07 +0000 Subject: [PATCH] - Fix tcp timeouts in tv.usec. git-svn-id: file:///svn/unbound/trunk@3795 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 +++ util/netevent.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 135a92fe4..91bc76fb3 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +16 June 2016: Wouter + - Fix tcp timeouts in tv.usec. + 15 June 2016: Wouter - TCP_TIMEOUT is specified in milliseconds. - If more than half of tcp connections are in use, a shorter timeout diff --git a/util/netevent.c b/util/netevent.c index f0918ecd6..a9340f3e2 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -777,7 +777,7 @@ int comm_point_perform_accept(struct comm_point* c, (*b->stop_accept)(b->cb_arg); /* set timeout, no mallocs */ tv.tv_sec = NETEVENT_SLOW_ACCEPT_TIME/1000; - tv.tv_usec = NETEVENT_SLOW_ACCEPT_TIME%1000; + tv.tv_usec = (NETEVENT_SLOW_ACCEPT_TIME%1000)*1000; b->eb->slow_accept = ub_event_new(b->eb->base, -1, UB_EV_TIMEOUT, comm_base_handle_slow_accept, b); @@ -2038,7 +2038,7 @@ comm_point_start_listening(struct comm_point* c, int newfd, int msec) ub_event_add_bits(c->ev->ev, UB_EV_TIMEOUT); #ifndef S_SPLINT_S /* splint fails on struct timeval. */ c->timeout->tv_sec = msec/1000; - c->timeout->tv_usec = msec%1000; + c->timeout->tv_usec = (msec%1000)*1000; #endif /* S_SPLINT_S */ } if(c->type == comm_tcp) {