[svn-commits] eliel: trunk r194283 - /trunk/main/manager.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 13 10:02:23 CDT 2009


Author: eliel
Date: Wed May 13 10:02:10 2009
New Revision: 194283

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=194283
Log:
Do not lock the 'sessions' container, lock the allocated 'session'.

There was a typo in the structure being locked, and we were locking the
'sessions' container instead of the 'session' structure thar we are modifying.
Reported by seanbright on #asterisk-dev, thanks!


Modified:
    trunk/main/manager.c

Modified: trunk/main/manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/manager.c?view=diff&rev=194283&r1=194282&r2=194283
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Wed May 13 10:02:10 2009
@@ -3376,7 +3376,6 @@
 	if (session == NULL) {
 		goto done;
 	}
-	ao2_lock(sessions);
 
 	flags = fcntl(ser->fd, F_GETFL);
 	if (!block_sockets) { /* make sure socket is non-blocking */
@@ -3386,6 +3385,7 @@
 	}
 	fcntl(ser->fd, F_SETFL, flags);
 
+	ao2_lock(session);
 	/* Hook to the tail of the event queue */
 	session->last_ev = grab_last();
 
@@ -3399,7 +3399,7 @@
 
 	AST_LIST_HEAD_INIT_NOLOCK(&session->datastores);
 
-	ao2_unlock(sessions);
+	ao2_unlock(session);
 	astman_append(&s, "Asterisk Call Manager/%s\r\n", AMI_VERSION);	/* welcome prompt */
 	for (;;) {
 		if ((res = do_message(&s)) < 0) {




More information about the svn-commits mailing list