[libss7-commits] mattf: branch mattf/bug13495 r243 - /team/mattf/bug13495/

SVN commits to the libss7 project libss7-commits at lists.digium.com
Fri Dec 12 15:04:51 CST 2008


Author: mattf
Date: Fri Dec 12 15:04:50 2008
New Revision: 243

URL: http://svn.digium.com/view/libss7?view=rev&rev=243
Log:
Make sure TCP links default to UP

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

Modified: team/mattf/bug13495/isup_masq.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/isup_masq.c?view=diff&rev=243&r1=242&r2=243
==============================================================================
--- team/mattf/bug13495/isup_masq.c (original)
+++ team/mattf/bug13495/isup_masq.c Fri Dec 12 15:04:50 2008
@@ -66,7 +66,7 @@
 			if (mtp2->master->debug > 0) { /* Send data to be decode for debug */
 				mtp3_dump(mtp2->master,NULL, (void *)newmsg, len-1);
 			}
-			mtp3_receive(mtp2->master, NULL, (void *)newmsg, len-1);
+			mtp3_receive(mtp2->master, mtp2, (void *)newmsg, len-1);
 			return 1; 	
 		default:
 			return 0;
@@ -95,6 +95,19 @@
 	return i;
 }
 
+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;
+}
+
 int isup_ip_receive(struct mtp2 *mtp2)
 {
 	unsigned char msg[1024];
@@ -107,6 +120,10 @@
 		return -1;
 
 	res = read(mtp2->fd, msg, len);
+
+	if (res == 0) {
+		isup_ip_link_down(mtp2);
+	}
 
 	if (res < 0) {
 		ss7_message(mtp2->master, "Read problem from socket: %s\n", strerror(errno));

Modified: team/mattf/bug13495/mtp3.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/mtp3.c?view=diff&rev=243&r1=242&r2=243
==============================================================================
--- team/mattf/bug13495/mtp3.c (original)
+++ team/mattf/bug13495/mtp3.c Fri Dec 12 15:04:50 2008
@@ -1882,10 +1882,12 @@
 		case MTP2_LINK_UP:
 			link = mtp2_event_to_mtp2(ss7, e->gen.data);
 			mtp3_event_link_up(link);
+			e->gen.data = (void *)link->fd;
 			return e;
 		case MTP2_LINK_DOWN:
 			link = mtp2_event_to_mtp2(ss7, e->gen.data);
 			mtp3_event_link_down(link);
+			e->gen.data = (void *)link->fd;
 			return e;
 		default:
 			return e;

Modified: team/mattf/bug13495/ss7.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/ss7.c?view=diff&rev=243&r1=242&r2=243
==============================================================================
--- team/mattf/bug13495/ss7.c (original)
+++ team/mattf/bug13495/ss7.c Fri Dec 12 15:04:50 2008
@@ -301,6 +301,11 @@
 		ss7->links[ss7->numlinks - 1] = m;
 
 		ss7_set_adjpc(ss7, fd, adjpc);
+
+		if (transport == SS7_TRANSPORT_TCP) {
+			ss7->links[ss7->numlinks - 1]->adj_sp->state = MTP3_UP;
+			ss7->mtp2_linkstate[ss7->numlinks - 1] = MTP2_LINKSTATE_UP;
+		}
 
 	} else {
 		return -1;




More information about the libss7-commits mailing list