mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
updating a timeout might corrupt RB tree. Remove before changing time.
svn:r24
This commit is contained in:
parent
4ec4cddece
commit
cc32570a08
5
event.c
5
event.c
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user