From: Andre <maan@p133.(none)>
Date: Fri, 7 Jul 2006 13:35:31 +0000 (+0200)
Subject: dccp_send: set IP_MULTICAST_LOOP for the ortp socket
X-Git-Tag: v0.2.14~59^2~5
X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=f3ce15a8bc3c0d64008e014b9147ddbd76f47a2d;p=paraslash.git

dccp_send: set IP_MULTICAST_LOOP for the ortp socket

This fixes sending to localhost.
---

diff --git a/ortp_send.c b/ortp_send.c
index dd4ee884..b084bb68 100644
--- a/ortp_send.c
+++ b/ortp_send.c
@@ -87,6 +87,20 @@ static void ortp_send_buf(char *buf, int len, long unsigned chunks_sent)
 	}
 }
 
+static int set_multicast(RtpSession *s)
+{
+	unsigned char loop = 1;
+	int ret;
+
+	ret = setsockopt(s->rtp.socket,
+		IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop));
+	if (ret < 0) {
+		PARA_ERROR_LOG("IP_MULTICAST_LOOP error %d\n", ret);
+
+	}
+	return 1;
+}
+
 static void ortp_init_session(struct ortp_target *ot)
 {
 	RtpSession *s;
@@ -108,7 +122,9 @@ static void ortp_init_session(struct ortp_target *ot)
 	if (ret < 0) {
 		rtp_session_destroy(ot->session);
 		ot->session = NULL;
+		return;
 	}
+	set_multicast(s);
 }
 
 /* called by afs */