diff options
author | dbailey <dbailey@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-18 21:10:14 +0000 |
---|---|---|
committer | dbailey <dbailey@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-18 21:10:14 +0000 |
commit | ba90166b1fe753aa1da4c84ac44312707c83836e (patch) | |
tree | f8006aee29b5290cf175d63ab611d118c8109687 /main/manager.c | |
parent | c9255ac03041680e738f5032a37dc59a6b1a1ac7 (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.4@82887 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/manager.c')
-rw-r--r-- | main/manager.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/main/manager.c b/main/manager.c index 351fcd713..6bd4a4e15 100644 --- a/main/manager.c +++ b/main/manager.c @@ -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; |