- multicast fix for bsd last_merge_to_janakj
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Wed, 6 Jul 2005 16:10:05 +0000 (16:10 +0000)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Wed, 6 Jul 2005 16:10:05 +0000 (16:10 +0000)
- removed some extra_debug info (too verbose)

io_wait.h
udp_server.c

index 4b58ca3..8a616a0 100644 (file)
--- a/io_wait.h
+++ b/io_wait.h
@@ -736,11 +736,6 @@ inline static int io_wait_loop_kqueue(io_wait_h* h, int t, int repeat)
 again:
                n=kevent(h->kq_fd, h->kq_changes, h->kq_nchanges,  h->kq_array,
                                        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 (errno==EINTR) goto again; /* signal, ignore it */
                        else{
index 2f6a11a..83cf933 100644 (file)
@@ -268,6 +268,9 @@ int udp_init(struct socket_info* sock_info)
 {
        union sockaddr_union* addr;
        int optval;
+#ifdef USE_MCAST
+       unsigned char m_ttl, m_loop;
+#endif
        addr=&sock_info->su;
 /*
        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 */
        if (addr->s.sa_family==AF_INET){
+               m_loop=mcast_loopback;
                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):"
                                                " %s\n", strerror(errno));
                        /* it's only a warning because we might get this error if the
                          network interface doesn't support multicasting -- andrei */
                }
                if (mcast_ttl>=0){
+                       m_ttl=mcast_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):"
                                                " %s\n", strerror(errno));
                        }