[libss7-commits] mattf: trunk r198 - /trunk/mtp2.c

SVN commits to the libss7 project libss7-commits at lists.digium.com
Sat Jul 19 11:08:42 CDT 2008


Author: mattf
Date: Sat Jul 19 11:08:41 2008
New Revision: 198

URL: http://svn.digium.com/view/libss7?view=rev&rev=198
Log:
Fix potential bug in which we might have lost the last MSU received, but we never checked the new FSN in the following FISUs which would cause us not to request retransmission of the lost MSU and potentially cause the remote end's T7 (message acknowledgement timer) to expire and reset the link

Modified:
    trunk/mtp2.c

Modified: trunk/mtp2.c
URL: http://svn.digium.com/view/libss7/trunk/mtp2.c?view=diff&rev=198&r1=197&r2=198
==============================================================================
--- trunk/mtp2.c (original)
+++ trunk/mtp2.c Sat Jul 19 11:08:41 2008
@@ -126,6 +126,14 @@
 	link->flags |= MTP2_FLAG_WRITE;
 
 	flush_bufs(link);
+}
+
+
+static void mtp2_request_retransmission(struct mtp2 *link)
+{
+	link->retransmissioncount++;
+	link->curbib = !link->curbib;
+	link->flags |= MTP2_FLAG_WRITE;
 }
 
 static int mtp2_queue_su(struct mtp2 *link, struct ss7_msg *m)
@@ -382,8 +390,6 @@
 
 static int fisu_rx(struct mtp2 *link, struct mtp_su_head *h, int len)
 {
-	int res = 0;
-
 	if (link->lastsurxd == FISU)
 		return 0;
 	else
@@ -394,15 +400,19 @@
 			return mtp2_setstate(link, MTP_ALIGNEDREADY);
 			/* Just in case our timers are a little off */
 		case MTP_ALIGNEDREADY:
-			return mtp2_setstate(link, MTP_INSERVICE);
+			mtp2_setstate(link, MTP_INSERVICE);
 		case MTP_INSERVICE:
+			if (h->fsn != link->lastfsnacked) {
+				mtp_message(link->master, "Received out of sequence FISU w/ fsn of %d, lastfsnacked = %d, requesting retransmission\n", h->fsn, link->lastfsnacked);
+				mtp2_request_retransmission(link);
+			}
 			break;
 		default:
 			mtp_message(link->master, "Huh?! Got FISU in link state %d\n", link->state);
 			return -1;
 	}
 	
-	return res;
+	return 0;
 }
 
 static void t1_expiry(void *data)
@@ -679,9 +689,7 @@
 
 	if (h->fsn != ((link->lastfsnacked+1) % 128)) {
 		mtp_message(link->master, "Received out of sequence MSU w/ fsn of %d, lastfsnacked = %d, requesting retransmission\n", h->fsn, link->lastfsnacked);
-		link->retransmissioncount++;
-		link->curbib = !link->curbib;
-		link->flags |= MTP2_FLAG_WRITE;
+		mtp2_request_retransmission(link);
 		return 0;
 	}
 




More information about the libss7-commits mailing list