[svn-commits] mattf: branch mattf/bug13495 r253 - in /team/mattf/bug13495: isup_masq.c mtp3.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Jan 24 16:30:31 CST 2009


Author: mattf
Date: Sat Jan 24 16:30:31 2009
New Revision: 253

URL: http://svn.digium.com/svn-view/libss7?view=rev&rev=253
Log:
Make sure that we pass a link down event up when the TCP link goes down

Modified:
    team/mattf/bug13495/isup_masq.c
    team/mattf/bug13495/mtp3.c

Modified: team/mattf/bug13495/isup_masq.c
URL: http://svn.digium.com/svn-view/libss7/team/mattf/bug13495/isup_masq.c?view=diff&rev=253&r1=252&r2=253
==============================================================================
--- team/mattf/bug13495/isup_masq.c (original)
+++ team/mattf/bug13495/isup_masq.c Sat Jan 24 16:30:31 2009
@@ -92,40 +92,40 @@
 	}
 }	
 
+static void isup_ip_link_down(struct mtp2 *mtp2)
+{
+	ss7_event *e = ss7_next_empty_event(mtp2->master);
+
+	if (!e) {
+		ss7_message(mtp2->master, "Could not allocate new event in isup_ip_link_down\n");
+		return;
+	}
+
+	e->e = MTP2_LINK_DOWN;
+	e->gen.data = mtp2->fd;
+
+	mtp2->fd = -1;
+}
+
 static int get_msg_length(struct mtp2 *mtp2)
 {
 	unsigned char lenbuf[2];
 	int res;
 
 	res = read(mtp2->fd, lenbuf, sizeof(lenbuf));
+
+	if (res == 0) {
+		isup_ip_link_down(mtp2);
+		return 0;
+	}
 
 	if (res != 2) {
 		ss7_message(mtp2->master, "Read len of %d:%s\n", res, strerror(errno));
 		return -1;
 	}
 
-	if ((res < 0) && (errno == 104)) {
-		ss7_message(mtp2->master, "Link dropped\n");
-		return -1;
-	}
-
 	return (lenbuf[0] << 8) | lenbuf[1];
 }
-
-#if 0
-static void isup_ip_link_down(struct mtp2 *mtp2)
-{
-	ss7_event *e = ss7_next_empty_event(mtp2->master);
-
-	if (!e) {
-		ss7_message(mtp2->master, "Could not allocate new event in isup_ip_link_down\n");
-		return;
-	}
-
-	e->e = MTP2_LINK_DOWN;
-	e->gen.data = mtp2;
-}
-#endif
 
 int isup_ip_receive(struct mtp2 *mtp2)
 {

Modified: team/mattf/bug13495/mtp3.c
URL: http://svn.digium.com/svn-view/libss7/team/mattf/bug13495/mtp3.c?view=diff&rev=253&r1=252&r2=253
==============================================================================
--- team/mattf/bug13495/mtp3.c (original)
+++ team/mattf/bug13495/mtp3.c Sat Jan 24 16:30:31 2009
@@ -1845,7 +1845,8 @@
 	struct ss7 *ss7 = link->master;
 	/* Make sure we notify MTP3 that the link went down beneath us */
 	mtp3_setstate_mtp2link(ss7, link, MTP2_LINKSTATE_DOWN);
-	mtp3_link_failed(link);
+	if (!(link->flags & MTP2_FLAG_TCP))
+		mtp3_link_failed(link);
 }
 
 static struct mtp2 * slc_to_mtp2(struct ss7 *ss7, unsigned int slc)




More information about the svn-commits mailing list