[sr-dev] git:master: modules/msrp: Better fix for the relay problem

Peter Dunkley peter.dunkley at crocodile-rcs.com
Thu Oct 25 22:36:52 CEST 2012


Module: sip-router
Branch: master
Commit: 6b9e4fcc176e3141f25c74f17f599b88d30f8ff9
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6b9e4fcc176e3141f25c74f17f599b88d30f8ff9

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Thu Oct 25 21:09:40 2012 +0100

modules/msrp: Better fix for the relay problem

---

 modules/msrp/msrp_netio.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/modules/msrp/msrp_netio.c b/modules/msrp/msrp_netio.c
index ba8e884..f9acca1 100644
--- a/modules/msrp/msrp_netio.c
+++ b/modules/msrp/msrp_netio.c
@@ -113,8 +113,6 @@ int msrp_relay(msrp_frame_t *mf)
 	memcpy(p, fpath->name.s + 11, mf->buf.s + mf->buf.len - fpath->name.s - 11);
 	p += mf->buf.s + mf->buf.len - fpath->name.s - 11;
 
-	sar = (str_array_t*)tpath->parsed.data;
-	
 	env = msrp_get_env();
 	if(env->envflags&MSRP_ENV_DSTINFO)
 	{
@@ -126,6 +124,7 @@ int msrp_relay(msrp_frame_t *mf)
 		LM_ERR("error parsing To-Path header\n");
 		return -1;
 	}
+	sar = (str_array_t*)tpath->parsed.data;
 	if(sar==NULL || sar->size<2)
 	{
 		LM_DBG("To-Path has no next hop URI -- nowehere to forward\n");
@@ -138,10 +137,8 @@ int msrp_relay(msrp_frame_t *mf)
 	}
 	dst = &env->dstinfo;
 done:
-	if (sar->size == 2)
+	if (dst->send_flags.f & SND_F_FORCE_CON_REUSE)
 	{
-		/* If the next hop is a client a connection must already
-		   exist... */
 		port = su_getport(&dst->to);
 		if (likely(port))
 		{
@@ -179,7 +176,6 @@ done:
 			return -1;
 		}
 	}
-	/* If the next hop is a relay just throw it out there... */
 	else if (tcp_send(dst, 0, reqbuf, p - reqbuf) < 0) {
 			LM_ERR("forwarding frame failed\n");
 			return -1;




More information about the sr-dev mailing list