Reduce length of time that 'asterisk -rx' waits.
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 8 Jul 2008 20:17:08 +0000 (20:17 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 8 Jul 2008 20:17:08 +0000 (20:17 +0000)
(closes issue #13001)
 Reported by: eliel
 Patches:
       20080708__bug13001.diff.txt uploaded by Corydon76 (license 14)
       20080708__bug13001.diff.txt.fixed uploaded by eliel (license 64)
 Tested by: Corydon76, eliel

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129114 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/asterisk.c

index 9bbeebd..739bf3d 100644 (file)
@@ -1032,6 +1032,10 @@ static void *netconsole(void *vconsole)
                                break;
                        }
                        tmp[res] = 0;
+                       if (strncmp(tmp, "cli quit after ", 15) == 0) {
+                               ast_cli_command_multiple(con->fd, res - 15, tmp + 15);
+                               break;
+                       }
                        ast_cli_command_multiple(con->fd, res, tmp);
                }
                if (fds[1].revents) {
@@ -2439,8 +2443,12 @@ static void ast_remotecontrol(char * data)
        int num = 0;
 
        read(ast_consock, buf, sizeof(buf));
-       if (data)
-               write(ast_consock, data, strlen(data) + 1);
+       if (data) {
+               char prefix[] = "cli quit after ";
+               char *tmp = alloca(strlen(data) + strlen(prefix) + 1);
+               sprintf(tmp, "%s%s", prefix, data);
+               write(ast_consock, tmp, strlen(tmp) + 1);
+       }
        stringp = buf;
        hostname = strsep(&stringp, "/");
        cpid = strsep(&stringp, "/");