[svn-commits] mattf: trunk r157 - in /trunk: mtp2.c mtp3.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 1 13:20:10 CDT 2008


Author: mattf
Date: Thu May  1 13:20:09 2008
New Revision: 157

URL: http://svn.digium.com/view/libss7?view=rev&rev=157
Log:
Make sure that if a link goes down during operation for any reason, that we report it to MTP3

Modified:
    trunk/mtp2.c
    trunk/mtp3.c

Modified: trunk/mtp2.c
URL: http://svn.digium.com/view/libss7/trunk/mtp2.c?view=diff&rev=157&r1=156&r2=157
==============================================================================
--- trunk/mtp2.c (original)
+++ trunk/mtp2.c Thu May  1 13:20:09 2008
@@ -571,7 +571,17 @@
 			link->state = newstate;
 			return 0;
 		case MTP_INSERVICE:
-			return to_idle(link);
+			if (nextstate != MTP_INSERVICE) {
+				e = ss7_next_empty_event(link->master);
+				if (!e) {
+					mtp_error(link->master, "Could not queue event\n");
+					return -1;
+				}
+				e->gen.e = MTP2_LINK_DOWN;
+				e->gen.data = link->slc;
+				return to_idle(link);
+			}
+			break;
 	}
 	return 0;
 }

Modified: trunk/mtp3.c
URL: http://svn.digium.com/view/libss7/trunk/mtp3.c?view=diff&rev=157&r1=156&r2=157
==============================================================================
--- trunk/mtp3.c (original)
+++ trunk/mtp3.c Thu May  1 13:20:09 2008
@@ -546,6 +546,14 @@
 	std_test_send(link);
 }
 
+static void mtp3_event_link_down(struct mtp2 *link)
+{
+	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);
+}
+
 static struct mtp2 * slc_to_mtp2(struct ss7 *ss7, unsigned int slc)
 {
 	int i = 0;
@@ -572,6 +580,10 @@
 			link = slc_to_mtp2(ss7, e->gen.data);
 			mtp3_event_link_up(link);
 			return e;
+		case MTP2_LINK_DOWN:
+			link = slc_to_mtp2(ss7, e->gen.data);
+			mtp3_event_link_down(link);
+			return e;
 		default:
 			return e;
 	}




More information about the svn-commits mailing list