[libss7-commits] mattf: branch mattf/libss7-ss7cluster r278 - /team/mattf/libss7-ss7cluster/

SVN commits to the libss7 project libss7-commits at lists.digium.com
Thu Jan 21 16:05:05 CST 2010


Author: mattf
Date: Thu Jan 21 16:05:02 2010
New Revision: 278

URL: http://svnview.digium.com/svn/libss7?view=rev&rev=278
Log:
Re-add back into the old ISUP front port locking around message routines

Modified:
    team/mattf/libss7-ss7cluster/Makefile
    team/mattf/libss7-ss7cluster/isup.c

Modified: team/mattf/libss7-ss7cluster/Makefile
URL: http://svnview.digium.com/svn/libss7/team/mattf/libss7-ss7cluster/Makefile?view=diff&rev=278&r1=277&r2=278
==============================================================================
--- team/mattf/libss7-ss7cluster/Makefile (original)
+++ team/mattf/libss7-ss7cluster/Makefile Thu Jan 21 16:05:02 2010
@@ -68,7 +68,7 @@
 	gcc -g -o ss7test ss7test.c libss7.a -lpthread
 
 ss7d: ss7d.c $(STATIC_LIBRARY)
-	gcc -g -o ss7d ss7d.c libss7.a -lpthread
+	gcc -g -o ss7d ss7d.c -lpthread -lss7
 
 ss7d-client: ss7d-client.c $(STATIC_LIBRARY)
 	gcc -g -o ss7d-client ss7d-client.c libss7.a -lpthread

Modified: team/mattf/libss7-ss7cluster/isup.c
URL: http://svnview.digium.com/svn/libss7/team/mattf/libss7-ss7cluster/isup.c?view=diff&rev=278&r1=277&r2=278
==============================================================================
--- team/mattf/libss7-ss7cluster/isup.c (original)
+++ team/mattf/libss7-ss7cluster/isup.c Thu Jan 21 16:05:02 2010
@@ -3097,6 +3097,7 @@
 
 int isup_cqr(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char status[])
 {
+	int res;
 	struct isup_call call;
 	int i;
 
@@ -3110,11 +3111,15 @@
 	if (call.range > 31)
 		return -1;
 
-	return isup_send_message(ss7, &call, ISUP_CQR, cqr_params);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message(ss7, &call, ISUP_CQR, cqr_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_grs(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc)
 {
+	int res;
 	struct isup_call call;
 
 	if (!ss7)
@@ -3127,11 +3132,16 @@
 	if (call.range > 31)
 		return -1;
 
-	return isup_send_message(ss7, &call, ISUP_GRS, greset_params);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message(ss7, &call, ISUP_GRS, greset_params);
+	pthread_mutex_lock(&ss7->lock);
+
+	return res;
 }
 
 int isup_gra(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc)
 {
+	int res;
 	struct isup_call call;
 
 	if (!ss7)
@@ -3143,23 +3153,34 @@
 	if (call.range > 31)
 		return -1;
 
-	return isup_send_message(ss7, &call, ISUP_GRA, greset_params);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message(ss7, &call, ISUP_GRA, greset_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_cgb(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_cicgroupmessage(ss7, ISUP_CGB, begincic, endcic, dpc, state, type);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_cicgroupmessage(ss7, ISUP_CGB, begincic, endcic, dpc, state, type);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_cgu(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_cicgroupmessage(ss7, ISUP_CGU, begincic, endcic, dpc, state, type);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_cicgroupmessage(ss7, ISUP_CGU, begincic, endcic, dpc, state, type);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_cgba(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
@@ -3167,84 +3188,124 @@
 	if (!ss7)
 		return -1;
 	return isup_send_cicgroupmessage(ss7, ISUP_CGBA, begincic, endcic, dpc, state, type);
-}
-
-int isup_cgua(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
-{
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_cicgroupmessage(ss7, ISUP_CGUA, begincic, endcic, dpc, state, type);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_cicgroupmessage(ss7, ISUP_CGUA, begincic, endcic, dpc, state, type);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
+}
+
+int isup_cgua(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
+{
+	int res;
+	if (!ss7)
+		return -1;
+
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_cicgroupmessage(ss7, ISUP_CGUA, begincic, endcic, dpc, state, type);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_iam(struct ss7 *ss7, struct isup_call *c)
 {
+	int res;
 	if (!ss7 || !c)
 		return -1;
 
+	pthread_mutex_lock(&ss7->lock);
 	if (ss7->switchtype == SS7_ITU)
-		return isup_send_message(ss7, c, ISUP_IAM, iam_params);
+		res = isup_send_message(ss7, c, ISUP_IAM, iam_params);
 	else
-		return isup_send_message(ss7, c, ISUP_IAM, ansi_iam_params);
+		res = isup_send_message(ss7, c, ISUP_IAM, ansi_iam_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_acm(struct ss7 *ss7, struct isup_call *c)
 {
+	int res;
 	if (!ss7 || !c)
 		return -1;
 
-	return isup_send_message(ss7, c, ISUP_ACM, acm_params);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message(ss7, c, ISUP_ACM, acm_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_faa(struct ss7 *ss7, struct isup_call *c)
 {
+	int res;
 	if (!ss7 || !c)
 		return -1;
 	
-	return isup_send_message(ss7, c, ISUP_FAA, faa_params);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message(ss7, c, ISUP_FAA, faa_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_far(struct ss7 *ss7, struct isup_call *c)
 {
+	int res;
 	if (!ss7 || !c)
 		return -1;
 	
+	pthread_mutex_lock(&ss7->lock);
 	if (c->next && c->next->call_ref_ident) {
 		c->call_ref_ident = c->next->call_ref_ident;
 		c->call_ref_pc = c->next->call_ref_pc;
-		return isup_send_message(ss7, c, ISUP_FAR, far_params);
-	}
-	return -1;
+		res = isup_send_message(ss7, c, ISUP_FAR, far_params);
+	} else
+		res = -1;
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_anm(struct ss7 *ss7, struct isup_call *c)
 {
+	int res;
 	if (!ss7 || !c)
 		return -1;
 
-	return isup_send_message(ss7, c, ISUP_ANM, anm_params);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message(ss7, c, ISUP_ANM, anm_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_con(struct ss7 *ss7, struct isup_call *c)
 {
+	int res;
 	if (!ss7 || !c)
 		return -1;
 
-	return isup_send_message(ss7, c, ISUP_CON, con_params);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message(ss7, c, ISUP_CON, con_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_rel(struct ss7 *ss7, struct isup_call *c, int cause)
 {
+	int res;
 	if (!ss7 || !c)
 		return -1;
 
 	if (cause < 0)
 		cause = 16;
 
+	pthread_mutex_lock(&ss7->lock);
 	c->cause = cause;
 	c->causecode = CODE_CCITT;
 	c->causeloc = LOC_PRIV_NET_LOCAL_USER;
-	return isup_send_message(ss7, c, ISUP_REL, rel_params);
+	res = isup_send_message(ss7, c, ISUP_REL, rel_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_rlc(struct ss7 *ss7, struct isup_call *c)
@@ -3254,8 +3315,10 @@
 	if (!ss7 || !c)
 		return -1;
 
+	pthread_mutex_lock(&ss7->lock);
 	res = isup_send_message(ss7, c, ISUP_RLC, empty_params);
 	isup_free_call(ss7, c);
+	pthread_mutex_unlock(&ss7->lock);
 	return res;
 }
 
@@ -3271,75 +3334,112 @@
 
 int isup_cpg(struct ss7 *ss7, struct isup_call *c, int event)
 {
+	int res;
+
 	if (!ss7 || !c)
 		return -1;
 
+	pthread_mutex_lock(&ss7->lock);
 	c->event_info = event;
-	return isup_send_message(ss7, c, ISUP_CPG, cpg_params);
+	res = isup_send_message(ss7, c, ISUP_CPG, cpg_params);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_rsc(struct ss7 *ss7, int cic, unsigned int dpc)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_message_ciconly(ss7, ISUP_RSC, cic, dpc);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message_ciconly(ss7, ISUP_RSC, cic, dpc);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_blo(struct ss7 *ss7, int cic, unsigned int dpc)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_message_ciconly(ss7, ISUP_BLO, cic, dpc);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message_ciconly(ss7, ISUP_BLO, cic, dpc);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_ubl(struct ss7 *ss7, int cic, unsigned int dpc)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_message_ciconly(ss7, ISUP_UBL, cic, dpc);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message_ciconly(ss7, ISUP_UBL, cic, dpc);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_bla(struct ss7 *ss7, int cic, unsigned int dpc)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_message_ciconly(ss7, ISUP_BLA, cic, dpc);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message_ciconly(ss7, ISUP_BLA, cic, dpc);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_lpa(struct ss7 *ss7, int cic, unsigned int dpc)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_message_ciconly(ss7, ISUP_LPA, cic, dpc);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message_ciconly(ss7, ISUP_LPA, cic, dpc);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_ucic(struct ss7 *ss7, int cic, unsigned int dpc)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_message_ciconly(ss7, ISUP_UCIC, cic, dpc);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message_ciconly(ss7, ISUP_UCIC, cic, dpc);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_uba(struct ss7 *ss7, int cic, unsigned int dpc)
 {
+	int res;
 	if (!ss7)
 		return -1;
 
-	return isup_send_message_ciconly(ss7, ISUP_UBA, cic, dpc);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message_ciconly(ss7, ISUP_UBA, cic, dpc);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 int isup_cvr(struct ss7 *ss7, int cic, unsigned int dpc)
 {
+	int res;
 	if (!ss7)
 		return -1;
 	
-	return isup_send_message_ciconly(ss7, ISUP_CVR, cic, dpc);
+	pthread_mutex_lock(&ss7->lock);
+	res = isup_send_message_ciconly(ss7, ISUP_CVR, cic, dpc);
+	pthread_mutex_unlock(&ss7->lock);
+	return res;
 }
 
 




More information about the libss7-commits mailing list