[svn-commits] mattf: branch mattf/libpri-1.4-q921-rewrite r1363 - /team/mattf/libpri-1.4-q9...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Dec 7 17:02:29 CST 2009


Author: mattf
Date: Mon Dec  7 17:02:25 2009
New Revision: 1363

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1363
Log:
Add more MDL handling code for NT-PTMP TEI error handling.  Also add PRI_EVENT_DCHAN_DOWN when it should be down on PTP links for backwards compatibility.

Modified:
    team/mattf/libpri-1.4-q921-rewrite/pri_internal.h
    team/mattf/libpri-1.4-q921-rewrite/q921.c

Modified: team/mattf/libpri-1.4-q921-rewrite/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/mattf/libpri-1.4-q921-rewrite/pri_internal.h?view=diff&rev=1363&r1=1362&r2=1363
==============================================================================
--- team/mattf/libpri-1.4-q921-rewrite/pri_internal.h (original)
+++ team/mattf/libpri-1.4-q921-rewrite/pri_internal.h Mon Dec  7 17:02:25 2009
@@ -93,6 +93,7 @@
 	int mdl_error;
 	int mdl_error_state;
 	int mdl_timer;
+	int mdl_free_me;
 
 	/* Q.921 State */
 	int q921_state;	

Modified: team/mattf/libpri-1.4-q921-rewrite/q921.c
URL: http://svnview.digium.com/svn/libpri/team/mattf/libpri-1.4-q921-rewrite/q921.c?view=diff&rev=1363&r1=1362&r2=1363
==============================================================================
--- team/mattf/libpri-1.4-q921-rewrite/q921.c (original)
+++ team/mattf/libpri-1.4-q921-rewrite/q921.c Mon Dec  7 17:02:25 2009
@@ -1113,6 +1113,14 @@
 		pri_error(pri, "Cannot handle MDL remove when PRI is in state %d\n", pri->q921_state);
 		break;
 	}
+
+	if (BRI_NT_PTMP(pri) && pri->q921_state == Q921_TEI_UNASSIGNED) {
+		if (pri == PRI_MASTER(pri)) {
+			pri_error(pri, "Bad bad bad!  Asked to free master\n");
+			return;
+		}
+		pri->mdl_free_me = 1;
+	}
 }
 
 static int q921_mdl_handle_network_error(struct pri *pri, char error)
@@ -1123,6 +1131,9 @@
 	case 'D':
 	case 'G':
 	case 'H':
+		q921_mdl_remove(pri);
+		handled = 1;
+		break;
 	case 'A':
 	case 'B':
 	case 'E':
@@ -1172,6 +1183,11 @@
 		/* We pick it back up and put it back together for this case */
 		q921_discard_iqueue(pri);
 		q921_establish_data_link(pri);
+		q921_setstate(pri, Q921_AWAITING_ESTABLISHMENT);
+
+		pri->schedev = 1;
+		pri->ev.gen.e = PRI_EVENT_DCHAN_DOWN;
+
 		handled = 1;
 		break;
 	default:
@@ -1224,6 +1240,8 @@
 		pri_error(pri, "MDL-ERROR (%c) in state %d\n", error, errored_state);
 	
 	}
+
+	return;
 }
 
 static void q921_mdl_handle_error_callback(void *vpri)
@@ -1234,6 +1252,32 @@
 
 	pri->mdl_error = 0;
 	pri->mdl_timer = 0;
+
+	if (pri->mdl_free_me) {
+		struct pri *master = PRI_MASTER(pri);
+		struct pri *freep = NULL, *prev, *cur;
+		prev = master;
+		cur = master->subchannel;
+
+		while (cur) {
+			if (cur == pri) {
+				prev->subchannel = cur->subchannel;
+				freep = cur;
+				break;
+			}
+			prev = cur;
+			cur = cur->subchannel;
+		}
+
+		if (free == NULL) {
+			pri_error(pri, "Huh!? no match found in list for TEI %d\n", pri->tei);
+			return;
+		}
+
+		free(free);
+	}
+
+	return;
 }
 
 static void q921_mdl_error(struct pri *pri, char error)




More information about the svn-commits mailing list