[svn-commits] rmudgett: branch 1.4 r2101 - /branches/1.4/q921.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 5 14:24:05 CDT 2010


Author: rmudgett
Date: Fri Nov  5 14:24:01 2010
New Revision: 2101

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2101
Log:
Remove all TEIs when NT PTMP starts.

Remove all TEIs when a NT PTMP link is started and there are no other
links to make sure there are no devices that think they have a TEI.  A
device may think it has a TEI if the upper layer program is restarted or
the system reboots.

This fixes the bug portion of JIRA LIBPRI-51/SWP-2453.

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=2101&r1=2100&r2=2101
==============================================================================
--- branches/1.4/q921.c (original)
+++ branches/1.4/q921.c Fri Nov  5 14:24:01 2010
@@ -239,6 +239,16 @@
 {
 	link->n202_counter = 0;
 	t202_expire(link);
+}
+
+static void q921_tei_remove(struct pri *ctrl, int tei)
+{
+	/*
+	 * Q.921 Section 5.3.2 says we should send the remove message
+	 * twice, in case of message loss.
+	 */
+	q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, tei, 1);
+	q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, tei, 1);
 }
 
 static void q921_send_dm(struct q921_link *link, int fbit)
@@ -2588,9 +2598,7 @@
 			pri_message(ctrl, "Sending TEI release, in order to re-establish TEI state\n");
 		}
 	
-		/* Q.921 says we should send the remove message twice, in case of link corruption */
-		q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, h->h.tei, 1);
-		q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, h->h.tei, 1);
+		q921_tei_remove(ctrl, h->h.tei);
 	}
 
 	return NULL;
@@ -2694,6 +2702,15 @@
 		} else {
 			q921_setstate(link, Q921_TEI_UNASSIGNED);
 			pri_schedule_event(ctrl, 0, nt_ptmp_dchannel_up, ctrl);
+			if (!ctrl->link.next) {
+				/*
+				 * We do not have any TEI's so make sure there are no devices
+				 * that think they have a TEI.  A device may think it has a TEI
+				 * if the upper layer program is restarted or the system
+				 * reboots.
+				 */
+				q921_tei_remove(ctrl, Q921_TEI_GROUP);
+			}
 		}
 	} else {
 		/* PTP mode, no need for TEI management junk */




More information about the svn-commits mailing list