[libss7-commits] mattf: trunk r138 - /trunk/mtp3.c

SVN commits to the libss7 project libss7-commits at lists.digium.com
Fri Jan 18 16:22:32 CST 2008


Author: mattf
Date: Fri Jan 18 16:22:31 2008
New Revision: 138

URL: http://svn.digium.com/view/libss7?view=rev&rev=138
Log:
Make sure we don't send messages on links that are down on a linkset

Modified:
    trunk/mtp3.c

Change Statistics:
 trunk/mtp3.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Modified: trunk/mtp3.c
URL: http://svn.digium.com/view/libss7/trunk/mtp3.c?view=diff&rev=138&r1=137&r2=138
==============================================================================
--- trunk/mtp3.c (original)
+++ trunk/mtp3.c Fri Jan 18 16:22:31 2008
@@ -158,7 +158,20 @@
 
 static inline struct mtp2 * sls_to_link(struct ss7 *ss7, unsigned char sls)
 {
-	return ss7->links[sls % ss7->numlinks];
+	if (ss7->mtp2_linkstate[sls % ss7->numlinks] == MTP2_LINKSTATE_UP)
+		return ss7->links[sls % ss7->numlinks];
+	else {
+		struct mtp2 *winner = ss7->links[0];
+
+		for (i = 0; i < ss7->numlinks; i++) {
+			if (ss7->mtp2_linkstate[i] == MTP2_LINKSTATE_UP) {
+				winner = ss7->links[i];
+				break;
+			}
+		}
+
+		return winner;
+	}
 }
 
 struct net_mng_message net_mng_messages[] = {




More information about the libss7-commits mailing list