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) {