fix a problem with epoll and event_reinit; reported by Alexander Drozdov

svn:r917
This commit is contained in:
Niels Provos 2008-07-25 00:19:15 +00:00
parent a4e2f52a44
commit e67a5ea9bb
3 changed files with 17 additions and 3 deletions

View File

@ -118,7 +118,7 @@ Changes in current version:
o Various HTTP correctness fixes from Scott Lamb
o Fix a bug where deleting signals with the kqueue backend would cause subsequent adds to fail
o Support multiple events listening on the same signal; make signals regular events that go on the same event queue; problem report by Alexander Drozdov.
o Fix a problem with epoll() and reinit; problem report by Alexander Drozdov.
Changes in 1.4.0:
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
o demote most http warnings to debug messages

17
event.c
View File

@ -328,9 +328,20 @@ event_base_free(struct event_base *base)
++n_deleted;
}
for (i = 0; i < base->nactivequeues; ++i) {
for (ev = TAILQ_FIRST(base->activequeues[i]); ev; ) {
struct event *next = TAILQ_NEXT(ev, ev_active_next);
if (!(ev->ev_flags & EVLIST_INTERNAL)) {
event_del(ev);
++n_deleted;
}
ev = next;
}
}
if (n_deleted)
event_debug(("%s: %d events were still set in base",
__func__, n_deleted));
__func__, n_deleted));
if (base->evsel->dealloc != NULL)
base->evsel->dealloc(base, base->evbase);
@ -363,6 +374,10 @@ event_reinit(struct event_base *base)
if (!evsel->need_reinit)
return (0);
/* prevent internal delete */
if (base->sig.ev_signal_added)
base->sig.ev_signal_added = 0;
if (base->evsel->dealloc != NULL)
base->evsel->dealloc(base, base->evbase);
evbase = base->evbase = evsel->init(base);

View File

@ -335,7 +335,6 @@ evsignal_dealloc(struct event_base *base)
for (i = 0; i < NSIG; ++i) {
if (i < base->sig.sh_old_max && base->sig.sh_old[i] != NULL)
_evsignal_restore_handler(base, i);
assert(TAILQ_EMPTY(&base->sig.evsigevents[0]));
}
EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[0]);