]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixed a bug where http manager sessions prevented the eventq from being cleaned out...
authorDoug Bailey <dbailey@digium.com>
Tue, 18 Sep 2007 21:10:14 +0000 (21:10 +0000)
committerDoug Bailey <dbailey@digium.com>
Tue, 18 Sep 2007 21:10:14 +0000 (21:10 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82887 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index 351fcd713ffc35caed8c5678240a1431cf3b7612..6bd4a4e156e479ba32561a99b6e1096d291e26f0 100644 (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;