changeset 8504:2297a352dfd3 HEAD

ioloop: 0 ms timeouts could still have caused infinite looping.
author Timo Sirainen <tss@iki.fi>
date Sun, 30 Nov 2008 15:04:29 +0200
parents 16ca1b36e6c3
children 5cc1c4f3d38b
files src/lib/ioloop.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop.c	Sun Nov 30 04:20:18 2008 +0200
+++ b/src/lib/ioloop.c	Sun Nov 30 15:04:29 2008 +0200
@@ -157,8 +157,9 @@
 	if (timeout->msecs == 0) {
 		/* if we came here from io_loop_handle_timeouts(),
 		   next_run must be larger than tv_now or we could go to
-		   infinite loop */
-		timeout->next_run.tv_usec += 1000;
+		   infinite loop. +1000 to get 1 ms further, another +1000 to
+		   account for timeout_update_next()'s truncation. */
+		timeout->next_run.tv_usec += 2000;
 		if (timeout->next_run.tv_usec >= 1000000) {
 			timeout->next_run.tv_sec++;
 			timeout->next_run.tv_usec -= 1000000;