Exit from session loop upon error (ie: they disconnected) and don't do any buffer...
authorJoshua Colp <jcolp@digium.com>
Fri, 12 Jan 2007 18:13:50 +0000 (18:13 +0000)
committerJoshua Colp <jcolp@digium.com>
Fri, 12 Jan 2007 18:13:50 +0000 (18:13 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50629 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index 53b34dd..88d8e26 100644 (file)
@@ -2139,10 +2139,6 @@ static int do_message(struct mansession *s)
                if (res == 0) {
                        continue;
                } else if (res > 0) {
                if (res == 0) {
                        continue;
                } else if (res > 0) {
-                       /* Strip trailing \r\n */
-                       if (strlen(header_buf) < 2)
-                               continue;
-                       header_buf[strlen(header_buf) - 2] = '\0';
                        if (ast_strlen_zero(header_buf))
                                return process_message(s, &m) ? -1 : 0;
                        else if (m.hdrcount < (AST_MAX_MANHEADERS - 1))
                        if (ast_strlen_zero(header_buf))
                                return process_message(s, &m) ? -1 : 0;
                        else if (m.hdrcount < (AST_MAX_MANHEADERS - 1))
@@ -2200,8 +2196,7 @@ static void *session_do(void *data)
        ast_mutex_unlock(&s->__lock);
        for (;;) {
                res = do_message(s);
        ast_mutex_unlock(&s->__lock);
        for (;;) {
                res = do_message(s);
-
-               if (process_events(s))
+               if ((res < 0) || (process_events(s)))
                        break;
        }
        /* session is over, explain why and terminate */
                        break;
        }
        /* session is over, explain why and terminate */