[libpri-commits] rmudgett: branch 1.4 r1151 - in /branches/1.4: pri.c pri_q921.h q921.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Wed Oct 7 13:33:13 CDT 2009


Author: rmudgett
Date: Wed Oct  7 13:33:09 2009
New Revision: 1151

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1151
Log:
Merged revisions 1143, 1144 from
https://origsvn.digium.com/svn/libpri/tags/1.4.10.2

  ..........
  r1144 | mattf | 2009-09-29 10:32:23 -0500 (Tue, 29 Sep 2009) | 1 line

  This fix is more like the fix that was used to resolve the issue for the PRI case
  ..........
  r1143 | mattf | 2009-09-28 14:07:01 -0500 (Mon, 28 Sep 2009) | 1 line

  Changes for 1.4.10.2
  ..........

Modified:
    branches/1.4/pri.c
    branches/1.4/pri_q921.h
    branches/1.4/q921.c

Modified: branches/1.4/pri.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/pri.c?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- branches/1.4/pri.c (original)
+++ branches/1.4/pri.c Wed Oct  7 13:33:09 2009
@@ -308,7 +308,7 @@
 {
 	/* Restart Q.921 layer */
 	if (pri) {
-		q921_reset(pri);
+		q921_reset(pri, 1);
 		q921_start(pri, pri->localtype == PRI_CPE);	
 	}
 	return 0;

Modified: branches/1.4/pri_q921.h
URL: http://svnview.digium.com/svn/libpri/branches/1.4/pri_q921.h?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- branches/1.4/pri_q921.h (original)
+++ branches/1.4/pri_q921.h Wed Oct  7 13:33:09 2009
@@ -186,7 +186,7 @@
 /* Bring up the D-channel */
 extern void q921_start(struct pri *pri, int now);
 
-extern void q921_reset(struct pri *pri);
+extern void q921_reset(struct pri *pri, int reset_iqueue);
 
 extern pri_event *q921_receive(struct pri *pri, q921_h *h, int len);
 

Modified: branches/1.4/q921.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/q921.c?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- branches/1.4/q921.c (original)
+++ branches/1.4/q921.c Wed Oct  7 13:33:09 2009
@@ -785,6 +785,12 @@
 
 pri_event *q921_dchannel_up(struct pri *pri)
 {
+	if (pri->tei == Q921_TEI_PRI) {
+		q921_reset(pri, 1);
+	} else {
+		q921_reset(pri, 0);
+	}
+
 	/* Stop any SABME retransmissions */
 	pri_schedule_del(pri, pri->sabme_timer);
 	pri->sabme_timer = 0;
@@ -797,7 +803,12 @@
 		pri_message(pri, DBGHEAD "q921_state now is Q921_LINK_CONNECTION_ESTABLISHED\n", DBGINFO);
 	pri->q921_state = Q921_LINK_CONNECTION_ESTABLISHED;
 
+	/* Ensure that we do not have T200 or T203 running when the link comes up */
+	pri_schedule_del(pri, pri->t200_timer);
+	pri->t200_timer = 0;
+
 	/* Start the T203 timer */
+	pri_schedule_del(pri, pri->t203_timer);
 	pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri);
 	
 	/* Notify Layer 3 */
@@ -813,7 +824,7 @@
 pri_event *q921_dchannel_down(struct pri *pri)
 {
 	/* Reset counters, reset sabme timer etc */
-	q921_reset(pri);
+	q921_reset(pri, 1);
 	
 	/* Notify Layer 3 */
 	q931_dl_indication(pri, PRI_EVENT_DCHAN_DOWN);
@@ -823,10 +834,12 @@
 	return &pri->ev;
 }
 
-void q921_reset(struct pri *pri)
+void q921_reset(struct pri *pri, int reset_iqueue)
 {
 	/* Having gotten a SABME we MUST reset our entire state */
-	pri->v_s = 0;
+	if (reset_iqueue)
+		pri->v_s = 0;
+
 	pri->v_a = 0;
 	pri->v_r = 0;
 	pri->v_na = 0;
@@ -848,7 +861,8 @@
 	pri->sentrej = 0;
 	
 	/* Discard anything waiting to go out */
-	q921_discard_retransmissions(pri);
+	if (reset_iqueue)
+		q921_discard_retransmissions(pri);
 }
 
 static void q921_tei_release_and_reacquire(struct pri *master)
@@ -1248,14 +1262,14 @@
 		return;
 	}
 	/* Reset our interface */
-	q921_reset(pri);
+	q921_reset(pri, 1);
 	/* Do the SABME XXX Maybe we should implement T_WAIT? XXX */
 	q921_send_sabme(pri, now);
 }
 
 void q921_start(struct pri *pri, int isCPE)
 {
-	q921_reset(pri);
+	q921_reset(pri, 1);
 	if ((pri->sapi == Q921_SAPI_LAYER2_MANAGEMENT) && (pri->tei == Q921_TEI_GROUP)) {
 		pri->q921_state = Q921_DOWN;
 		if (isCPE)




More information about the libpri-commits mailing list