]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Move event processing into do_message so that it gets executed again when events...
authorJoshua Colp <jcolp@digium.com>
Mon, 15 Jan 2007 16:36:07 +0000 (16:36 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 15 Jan 2007 16:36:07 +0000 (16:36 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@50895 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index 3761754a55a0efc03b412d9ff38c16d5f92f31f1..79ca6e94240c2b0cbb0744b9392162bb139e4c3d 100644 (file)
@@ -2059,6 +2059,11 @@ static int do_message(struct mansession *s)
        int res;
 
        for (;;) {
+               /* Check if any events are pending and do them if needed */
+               if (s->eventq->next) {
+                       if (process_events(s))
+                               return -1;
+               }
                res = get_input(s, header_buf);
                if (res == 0) {
                        continue;
@@ -2086,14 +2091,8 @@ static void *session_do(void *data)
        astman_append(s, "Asterisk Call Manager/1.0\r\n");
        ast_mutex_unlock(&s->__lock);
        for (;;) {
-               res = do_message(s);
-               
-               if (res < 0) {
+               if ((res = do_message(s)) < 0)
                        break;
-               } else if (s->eventq->next) {
-                       if (process_events(s))
-                               break;
-               }
        }
        if (s->authenticated) {
                if (option_verbose > 1) {