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

SVN commits to the libpri project libpri-commits at lists.digium.com
Sat Mar 1 16:43:42 CST 2008


Author: mattf
Date: Sat Mar  1 16:43:41 2008
New Revision: 534

URL: http://svn.digium.com/view/libpri?view=rev&rev=534
Log:
Some more updates to add code for passing PC 27.1 in Q.921

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

Modified: trunk/pri.c
URL: http://svn.digium.com/view/libpri/trunk/pri.c?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- trunk/pri.c (original)
+++ trunk/pri.c Sat Mar  1 16:43:41 2008
@@ -188,13 +188,10 @@
 }
 
 /* Pass in the master for this function */
-void __pri_free_tei(struct pri * p, int tei)
-{
-	pri_error(NULL, "Removing TEI %d\n", tei);
-	if (p->subchannel && (tei == p->subchannel->tei)) {
-		free(p->subchannel);
-		p->subchannel = NULL;
-	}
+void __pri_free_tei(struct pri * p)
+{
+	pri_error(NULL, "Freeing TEI %d\n", p->tei);
+	free (p);
 }
 
 struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri)

Modified: trunk/pri_internal.h
URL: http://svn.digium.com/view/libpri/trunk/pri_internal.h?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- trunk/pri_internal.h (original)
+++ trunk/pri_internal.h Sat Mar  1 16:43:41 2008
@@ -272,6 +272,6 @@
 
 struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri);
 
-void __pri_free_tei(struct pri *p, int tei);
+void __pri_free_tei(struct pri *p);
 
 #endif

Modified: trunk/q921.c
URL: http://svn.digium.com/view/libpri/trunk/q921.c?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- trunk/q921.c (original)
+++ trunk/q921.c Sat Mar  1 16:43:41 2008
@@ -813,9 +813,15 @@
 			pri_schedule_del(pri, pri->t202_timer);
 			pri->t202_timer = 0;
 		}
-		if (pri->subchannel) {
+		if (pri->subchannel && (pri->subchannel->tei == tei)) {
 			pri_error(pri, "TEI already assigned (new is %d, current is %d)\n", tei, pri->subchannel->tei);
-		}
+			ev = q921_dchannel_down(pri->subchannel);
+			__pri_free_tei(pri->subchannel);
+			pri->subchannel = NULL;
+			q921_start(pri, pri->localtype == PRI_CPE);
+			return NULL;
+		}
+
 		pri_message(pri, "TEI assiged to %d\n", tei);
 		pri->subchannel = __pri_new_tei(-1, pri->localtype, pri->switchtype, pri, NULL, NULL, NULL, tei, 1);
 		if (!pri->subchannel) {
@@ -843,8 +849,9 @@
 
 		if ((tei == Q921_TEI_GROUP) || (tei == pri->subchannel->tei)) {
 			ev = q921_dchannel_down(pri->subchannel);
-			__pri_free_tei(pri, tei);
-			q921_tei_request(pri);
+			__pri_free_tei(pri->subchannel);
+			pri->subchannel = NULL;
+			q921_start(pri, pri->localtype == PRI_CPE);
 		}
 	}
 	return NULL;	/* Do we need to return something??? */




More information about the libpri-commits mailing list