[libpri-commits] mattf: branch 1.4 r1878 - /branches/1.4/q921.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Mon Aug 23 17:13:49 CDT 2010


Author: mattf
Date: Mon Aug 23 17:13:44 2010
New Revision: 1878

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1878
Log:
Add silly fake MDL error Z for kicking L2 to reactivate if a DISC or DM is received in proper states on PTP links.

Modified:
    branches/1.4/q921.c

Modified: branches/1.4/q921.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/q921.c?view=diff&rev=1878&r1=1877&r2=1878
==============================================================================
--- branches/1.4/q921.c (original)
+++ branches/1.4/q921.c Mon Aug 23 17:13:44 2010
@@ -61,6 +61,7 @@
 static void q921_establish_data_link(struct pri *ctrl);
 static void q921_mdl_error(struct pri *ctrl, char error);
 static void q921_mdl_remove(struct pri *ctrl);
+static void q921_restart_ptp_link_if_needed(struct pri *ctrl);
 
 /*!
  * \internal
@@ -1168,6 +1169,7 @@
 		if (ctrl->q921_state == Q921_MULTI_FRAME_ESTABLISHED)
 			stop_t203(ctrl);
 		q921_setstate(ctrl, Q921_TEI_ASSIGNED);
+		q921_restart_ptp_link_if_needed(ctrl);
 		break;
 	default:
 		pri_error(ctrl, "Don't know what to do with DISC in state %d(%s)\n",
@@ -1284,6 +1286,10 @@
 	/* This is where we act a bit like L3 instead of L2, since we've got an L3 that depends on us
 	 * keeping L2 automatically alive and happy for point to point links */
 	switch (error) {
+	case 'Z':
+		/* This is a special MDL error that actually isn't a spec error, but just so we
+		 * have an asynchronous context from the state machine to kick a PTP link back
+		 * up after being requested to drop politely (using DISC or DM) */
 	case 'G':
 		/* We pick it back up and put it back together for this case */
 		q921_discard_iqueue(ctrl);
@@ -1302,6 +1308,13 @@
 	}
 
 	return handled;
+}
+
+static void q921_restart_ptp_link_if_needed(struct pri *ctrl)
+{
+	if (PTP_MODE(ctrl) && ctrl->mdl_error == 0) {
+		q921_mdl_error(ctrl, 'Z');
+	}
 }
 
 static void q921_mdl_handle_error(struct pri *ctrl, char error, int errored_state)
@@ -1816,6 +1829,7 @@
 		q931_dl_indication(ctrl, PRI_EVENT_DCHAN_DOWN);
 		stop_t200(ctrl);
 		q921_setstate(ctrl, Q921_TEI_ASSIGNED);
+		q921_restart_ptp_link_if_needed(ctrl);
 		break;
 	case Q921_AWAITING_RELEASE:
 		if (!h->u.p_f)




More information about the libpri-commits mailing list