updating a timeout might corrupt RB tree. Remove before changing time.

svn:r24
This commit is contained in:
Niels Provos 2002-05-20 21:47:04 +00:00
parent 4ec4cddece
commit cc32570a08

View File

@ -281,14 +281,15 @@ event_add(struct event *ev, struct timeval *tv)
if (tv != NULL) {
struct timeval now;
if (ev->ev_flags & EVLIST_TIMEOUT)
event_queue_remove(ev, EVLIST_TIMEOUT);
gettimeofday(&now, NULL);
timeradd(&now, tv, &ev->ev_timeout);
LOG_DBG((LOG_MISC, 55,
"event_add: timeout in %d seconds, call %p",
tv->tv_sec, ev->ev_callback));
if (ev->ev_flags & EVLIST_TIMEOUT)
event_queue_remove(ev, EVLIST_TIMEOUT);
event_queue_insert(ev, EVLIST_TIMEOUT);
}