Răsfoiți Sursa

- multicast fix for bsd
- removed some extra_debug info (too verbose)

Andrei Pelinescu-Onciul 20 ani în urmă
părinte
comite
90c6c74a8f
2 a modificat fișierele cu 7 adăugiri și 7 ștergeri
  1. 0 5
      io_wait.h
  2. 7 2
      udp_server.c

+ 0 - 5
io_wait.h

@@ -736,11 +736,6 @@ inline static int io_wait_loop_kqueue(io_wait_h* h, int t, int repeat)
 again:
 again:
 		n=kevent(h->kq_fd, h->kq_changes, h->kq_nchanges,  h->kq_array,
 		n=kevent(h->kq_fd, h->kq_changes, h->kq_nchanges,  h->kq_array,
 					h->fd_no, &tspec);
 					h->fd_no, &tspec);
-#ifdef EXTRA_DEBUG
-		DBG("DBG: kevent(%d, %p, %d, %p, %d, ...)=%d\n",
-			 h->kq_fd, h->kq_changes, h->kq_nchanges,  h->kq_array, h->fd_no,
-			 n);
-#endif
 		if (n==-1){
 		if (n==-1){
 			if (errno==EINTR) goto again; /* signal, ignore it */
 			if (errno==EINTR) goto again; /* signal, ignore it */
 			else{
 			else{

+ 7 - 2
udp_server.c

@@ -268,6 +268,9 @@ int udp_init(struct socket_info* sock_info)
 {
 {
 	union sockaddr_union* addr;
 	union sockaddr_union* addr;
 	int optval;
 	int optval;
+#ifdef USE_MCAST
+	unsigned char m_ttl, m_loop;
+#endif
 	addr=&sock_info->su;
 	addr=&sock_info->su;
 /*
 /*
 	addr=(union sockaddr_union*)pkg_malloc(sizeof(union sockaddr_union));
 	addr=(union sockaddr_union*)pkg_malloc(sizeof(union sockaddr_union));
@@ -318,16 +321,18 @@ int udp_init(struct socket_info* sock_info)
 	}
 	}
 	/* set the multicast options */
 	/* set the multicast options */
 	if (addr->s.sa_family==AF_INET){
 	if (addr->s.sa_family==AF_INET){
+		m_loop=mcast_loopback;
 		if (setsockopt(sock_info->socket, IPPROTO_IP, IP_MULTICAST_LOOP, 
 		if (setsockopt(sock_info->socket, IPPROTO_IP, IP_MULTICAST_LOOP, 
-						&mcast_loopback, sizeof(mcast_loopback))==-1){
+						&m_loop, sizeof(m_loop))==-1){
 			LOG(L_WARN, "WARNING: udp_init: setsockopt(IP_MULTICAST_LOOP):"
 			LOG(L_WARN, "WARNING: udp_init: setsockopt(IP_MULTICAST_LOOP):"
 						" %s\n", strerror(errno));
 						" %s\n", strerror(errno));
 			/* it's only a warning because we might get this error if the
 			/* it's only a warning because we might get this error if the
 			  network interface doesn't support multicasting -- andrei */
 			  network interface doesn't support multicasting -- andrei */
 		}
 		}
 		if (mcast_ttl>=0){
 		if (mcast_ttl>=0){
+			m_ttl=mcast_ttl;
 			if (setsockopt(sock_info->socket, IPPROTO_IP, IP_MULTICAST_TTL,
 			if (setsockopt(sock_info->socket, IPPROTO_IP, IP_MULTICAST_TTL,
-						&mcast_ttl, sizeof(mcast_ttl))==-1){
+						&m_ttl, sizeof(m_ttl))==-1){
 				LOG(L_WARN, "WARNING: udp_init: setsockopt (IP_MULTICAST_TTL):"
 				LOG(L_WARN, "WARNING: udp_init: setsockopt (IP_MULTICAST_TTL):"
 						" %s\n", strerror(errno));
 						" %s\n", strerror(errno));
 			}
 			}