--- bip-0.8.7/src/connection.c 2011-01-15 17:29:37.000000000 +0000 +++ bip/src/connection.c 2011-03-19 22:04:09.013163002 +0000 @@ -765,6 +765,7 @@ list_t *wait_event(list_t *cn_list, int { fd_set fds_read, fds_write, fds_except; int maxfd = -1, err; + int timeout = *msec; list_t *cn_newdata; list_iterator_t it; struct timeval tv; @@ -848,8 +849,9 @@ list_t *wait_event(list_t *cn_list, int else *msec -= (etv.tv_sec - btv.tv_sec) * 1000 + (etv.tv_usec - btv.tv_usec) / 1000; + /* in case we go forward in time */ - if (*msec < 0) + if (*msec < 0 || *msec > timeout) *msec = 0; mylog(LOG_DEBUGTOOMUCH, "msec: %d, sec: %d, usec: %d", *msec, tv.tv_sec, tv.tv_usec);