Fixed a bug where http manager sessions prevented the eventq from being cleaned out because http manager sessions do not have a valid file descriptor.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Doug Bailey
2007-09-18 21:10:14 +00:00
parent 4668601f9c
commit 33a1011c51

View File

@@ -1976,19 +1976,25 @@ static int process_events(struct mansession *s)
struct eventqent *eqe;
int ret = 0;
ast_mutex_lock(&s->__lock);
if (s->fd > -1) {
if (!s->eventq)
s->eventq = master_eventq;
while(s->eventq->next) {
eqe = s->eventq->next;
if ((s->authenticated && (s->readperm & eqe->category) == eqe->category) &&
((s->send_events & eqe->category) == eqe->category)) {
if (!s->eventq)
s->eventq = master_eventq;
while(s->eventq->next) {
eqe = s->eventq->next;
if ((s->authenticated && (s->readperm & eqe->category) == eqe->category) &&
((s->send_events & eqe->category) == eqe->category)) {
if (s->fd > -1) {
if (!ret && ast_carefulwrite(s->fd, eqe->eventdata, strlen(eqe->eventdata), s->writetimeout) < 0)
ret = -1;
} else {
if (!s->outputstr && !(s->outputstr = ast_calloc(1, sizeof(*s->outputstr)))) {
ast_mutex_unlock(&s->__lock);
return;
}
ast_dynamic_str_append(&s->outputstr, 0, "%s", buf->str);
}
unuse_eventqent(s->eventq);
s->eventq = eqe;
}
}
unuse_eventqent(s->eventq);
s->eventq = eqe;
}
ast_mutex_unlock(&s->__lock);
return ret;