(closes issue #10695)
authorJoshua Colp <jcolp@digium.com>
Tue, 11 Sep 2007 13:15:37 +0000 (13:15 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 11 Sep 2007 13:15:37 +0000 (13:15 +0000)
Reported by: junky
Patches:
      count_showconn.diff uploaded by junky (license 177)
Provide a count of connected users to manager.

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

main/manager.c

index 2a775a0..d9943ab 100644 (file)
@@ -625,14 +625,19 @@ static int handle_showmanconn(int fd, int argc, char *argv[])
 {
        struct mansession *s;
        char *format = "  %-15.15s  %-15.15s\n";
+       int count = 0;
 
        ast_cli(fd, format, "Username", "IP Address");
 
        AST_LIST_LOCK(&sessions);
-       AST_LIST_TRAVERSE(&sessions, s, list)
+       AST_LIST_TRAVERSE(&sessions, s, list) {
                ast_cli(fd, format,s->username, ast_inet_ntoa(s->sin.sin_addr));
+               count++;
+       }
        AST_LIST_UNLOCK(&sessions);
 
+       ast_cli(fd, "%d users connected.\n", count);
+
        return RESULT_SUCCESS;
 }