[asterisk-commits] bweschke: branch bweschke/patch-M9238 r81647 - /team/bweschke/patch-M9238/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 6 05:17:33 CDT 2007


Author: bweschke
Date: Thu Sep  6 05:17:33 2007
New Revision: 81647

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81647
Log:
 Patch as supplied by Ivan for issue #9238 


Modified:
    team/bweschke/patch-M9238/main/manager.c

Modified: team/bweschke/patch-M9238/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/patch-M9238/main/manager.c?view=diff&rev=81647&r1=81646&r2=81647
==============================================================================
--- team/bweschke/patch-M9238/main/manager.c (original)
+++ team/bweschke/patch-M9238/main/manager.c Thu Sep  6 05:17:33 2007
@@ -567,8 +567,8 @@
 	return RESULT_SUCCESS;
 }
 
-/*! \brief CLI command show manager connected */
-/* Should change to "manager show connected" */
+/*! \brief CLI command show manager eventq */
+/* Should change to "manager show eventq" */
 static int handle_showmaneventq(int fd, int argc, char *argv[])
 {
 	struct eventqent *s;
@@ -682,6 +682,12 @@
 static void destroy_session(struct mansession *s)
 {
 	AST_LIST_LOCK(&sessions);
+	struct eventqent *eqe;
+	while ((s->eventq)&&(s->eventq->next)) {
+	    eqe = s->eventq->next;
+	    unuse_eventqent(s->eventq);
+	    s->eventq = eqe;
+	};
 	AST_LIST_REMOVE(&sessions, s, list);
 	AST_LIST_UNLOCK(&sessions);
 
@@ -2277,8 +2283,6 @@
 		if (!(s = ast_calloc(1, sizeof(*s))))
 			continue;
 
-		ast_atomic_fetchadd_int(&num_sessions, 1);
-		
 		memcpy(&s->sin, &sin, sizeof(sin));
 		s->writetimeout = 100;
 		s->waiting_thread = AST_PTHREADT_NULL;
@@ -2302,7 +2306,11 @@
 		while(s->eventq->next)
 			s->eventq = s->eventq->next;
 		AST_LIST_UNLOCK(&sessions);
+
 		ast_atomic_fetchadd_int(&s->eventq->usecount, 1);
+
+		ast_atomic_fetchadd_int(&num_sessions, 1);
+		
 		if (ast_pthread_create_background(&s->t, &attr, session_do, s))
 			destroy_session(s);
 	}




More information about the asterisk-commits mailing list