[zaptel-commits] mattf: branch 1.2 r1608 - /branches/1.2/zaptel.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Thu Nov 16 17:51:42 MST 2006


Author: mattf
Date: Thu Nov 16 18:51:41 2006
New Revision: 1608

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1608
Log:
Fix for #7991.

Modified:
    branches/1.2/zaptel.c

Modified: branches/1.2/zaptel.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/zaptel.c?view=diff&rev=1608&r1=1607&r2=1608
==============================================================================
--- branches/1.2/zaptel.c (original)
+++ branches/1.2/zaptel.c Thu Nov 16 18:51:41 2006
@@ -4538,16 +4538,23 @@
 	span->flags &= ~ZT_FLAG_REGISTERED;
 	for (x=0;x<span->channels;x++)
 		zt_chan_unreg(&span->chans[x]);
-	maxspans = 0;
+	new_maxspans = 0;
+	new_master = master; /* FIXME: locking */
 	if (master == span)
-		master = NULL;
+		new_master = NULL;
 	for (x=1;x<ZT_MAX_SPANS;x++) {
 		if (spans[x]) {
-			maxspans = x+1;
-			if (!master)
-				master = spans[x];
-		}
-	}
+			new_maxspans = x+1;
+			if (!new_master)
+				new_master = spans[x];
+		}
+	}
+	maxspans = new_maxspans;
+	if (master != new_master)
+		if (debug)
+			printk("%s: Span ('%s') is new master\n", __FUNCTION__, 
+				(new_master)? new_master->name: "no master");
+	master = new_master;
 
 	return 0;
 }



More information about the zaptel-commits mailing list