mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-13 22:37:42 -04:00
if a timeout on the active list is rescheduled before it can execute it
gets removed from the active list; bug report from Jon Poland AT arbor.net svn:r65
This commit is contained in:
parent
30eff294f0
commit
f9e0c44925
16
event.c
16
event.c
@ -310,6 +310,22 @@ event_add(struct event *ev, struct timeval *tv)
|
|||||||
if (ev->ev_flags & EVLIST_TIMEOUT)
|
if (ev->ev_flags & EVLIST_TIMEOUT)
|
||||||
event_queue_remove(ev, EVLIST_TIMEOUT);
|
event_queue_remove(ev, EVLIST_TIMEOUT);
|
||||||
|
|
||||||
|
/* Check if it is active due to a timeout. Rescheduling
|
||||||
|
* this timeout before the callback can be executed
|
||||||
|
* removes it from the active list. */
|
||||||
|
if ((ev->ev_flags & EVLIST_ACTIVE) &&
|
||||||
|
(ev->ev_res & EV_TIMEOUT)) {
|
||||||
|
/* See if we are just active executing this
|
||||||
|
* event in a loop
|
||||||
|
*/
|
||||||
|
if (ev->ev_ncalls && ev->ev_pncalls) {
|
||||||
|
/* Abort loop */
|
||||||
|
*ev->ev_pncalls = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
event_queue_remove(ev, EVLIST_ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
timeradd(&now, tv, &ev->ev_timeout);
|
timeradd(&now, tv, &ev->ev_timeout);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user