[libpri-commits] mattf: trunk r542 - in /trunk: pri_internal.h q921.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Sat Mar 15 14:43:18 CDT 2008


Author: mattf
Date: Sat Mar 15 14:43:17 2008
New Revision: 542

URL: http://svn.digium.com/view/libpri?view=rev&rev=542
Log:
Make sure if we're a bri and in PTMP mode that we release the TEI and try to get a new one with the other end when we lose activity in multiframe mode

Modified:
    trunk/pri_internal.h
    trunk/q921.c

Modified: trunk/pri_internal.h
URL: http://svn.digium.com/view/libpri/trunk/pri_internal.h?view=diff&rev=542&r1=541&r2=542
==============================================================================
--- trunk/pri_internal.h (original)
+++ trunk/pri_internal.h Sat Mar 15 14:43:17 2008
@@ -84,6 +84,7 @@
 
 	/* Various timers */
 	int sabme_timer;	/* SABME retransmit */
+	int sabme_count;	/* SABME retransmit counter for BRI */
 	int t203_timer;		/* Max idle time */
 	int t202_timer;
 	int n202_counter;

Modified: trunk/q921.c
URL: http://svn.digium.com/view/libpri/trunk/q921.c?view=diff&rev=542&r1=541&r2=542
==============================================================================
--- trunk/q921.c (original)
+++ trunk/q921.c Sat Mar 15 14:43:17 2008
@@ -52,6 +52,7 @@
 
 static void reschedule_t203(struct pri *pri);
 static void q921_restart(struct pri *pri, int now);
+static void q921_tei_release_and_reacquire(struct pri *master);
 
 static void q921_discard_retransmissions(struct pri *pri)
 {
@@ -188,6 +189,15 @@
 	default:
 		pri_error(pri, "Don't know how to U/A on a type %d node\n", pri->localtype);
 		return;
+	}
+	if (pri->bri && (pri->state == Q921_AWAITING_ESTABLISH)) {
+		if (pri->sabme_count >= pri->timers[PRI_TIMER_N200]) {
+			pri_schedule_del(pri, pri->sabme_timer);
+			pri->sabme_timer = 0;
+			q921_tei_release_and_reacquire(pri->master);
+		} else {
+			pri->sabme_count++;
+		}
 	}
 	if (pri->debug & (PRI_DEBUG_Q921_STATE | PRI_DEBUG_Q921_DUMP))
 		pri_message(pri, "Sending Set Asynchronous Balanced Mode Extended\n");
@@ -421,9 +431,14 @@
 				pri_message(pri, DBGHEAD "q921_state now is Q921_LINK_CONNECTION_RELEASED\n", DBGINFO);
 			pri->q921_state = Q921_LINK_CONNECTION_RELEASED;
 			pri->t200_timer = 0;
-			q921_dchannel_down(pri);
-			q921_start(pri, 1);
-			pri->schedev = 1;
+			if (pri->bri && pri->master) {
+				q921_tei_release_and_reacquire(pri->master);
+				return;
+			} else {
+				q921_dchannel_down(pri);
+				q921_start(pri, 1);
+				pri->schedev = 1;
+			}
 		}
 	} else {
 		pri_error(pri, "T200 counter expired, nothing to send...\n");
@@ -752,6 +767,7 @@
 	if (pri->t200_timer)
 		pri_schedule_del(pri, pri->t200_timer);
 	pri->sabme_timer = 0;
+	pri->sabme_count = 0;
 	pri->t203_timer = 0;
 	pri->t200_timer = 0;
 	pri->busy = 0;
@@ -772,6 +788,8 @@
 	q921_dchannel_down(master->subchannel);
 	__pri_free_tei(master->subchannel);
 	master->subchannel = NULL;
+	master->ev.gen.e = PRI_EVENT_DCHAN_DOWN;
+	master->schedev = 1;
 	q921_start(master, master->localtype == PRI_CPE);
 }
 




More information about the libpri-commits mailing list