X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fnetwork%2Fudp.c;h=d0938b9a9cc070118f26fdd3024299644177174d;hb=f8a7b336e817e964e989519af4e1fe22df7e4861;hp=a73f9992b1d4db605c3c11b9924998199a63c74f;hpb=4ff9961862088bf74ca36f04ae3e34094ec9778f;p=vlc diff --git a/src/network/udp.c b/src/network/udp.c index a73f9992b1..d0938b9a9c 100644 --- a/src/network/udp.c +++ b/src/network/udp.c @@ -27,7 +27,11 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include #include @@ -53,6 +57,13 @@ # endif #endif +#ifdef HAVE_LINUX_DCCP_H +# include +# ifndef SOCK_DCCP /* provisional API */ +# define SOCK_DCCP 6 +# endif +#endif + #ifndef SOL_IP # define SOL_IP IPPROTO_IP #endif @@ -75,13 +86,6 @@ # define IPPROTO_UDPLITE 136 /* IANA */ #endif -#ifdef HAVE_LINUX_DCCP_H -# include -# ifndef SOCK_DCCP /* provisional API */ -# define SOCK_DCCP 6 -# endif -#endif - #if defined (HAVE_NETINET_UDPLITE_H) # include #elif defined (__linux__) @@ -379,7 +383,7 @@ net_IPv6Join (vlc_object_t *obj, int fd, const struct sockaddr_in6 *src) msg_Dbg (obj, "IPV6_JOIN_GROUP multicast request"); - if (!setsockopt (fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &gr6, sizeof (gr6))) + if (!setsockopt (fd, SOL_IPV6, IPV6_JOIN_GROUP, &gr6, sizeof (gr6))) return 0; #else errno = ENOSYS; @@ -612,10 +616,7 @@ int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port, { struct addrinfo hints, *res, *ptr; int i_val, i_handle = -1; - vlc_bool_t b_unreach = VLC_FALSE; - - if( i_port == 0 ) - i_port = 1234; /* historical VLC thing */ + bool b_unreach = false; if( i_hlim < 1 ) i_hlim = var_CreateGetInteger( p_this, "ttl" ); @@ -623,12 +624,12 @@ int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port, memset( &hints, 0, sizeof( hints ) ); hints.ai_socktype = SOCK_DGRAM; - msg_Dbg( p_this, "net: connecting to %s port %d", psz_host, i_port ); + msg_Dbg( p_this, "net: connecting to [%s]:%d", psz_host, i_port ); i_val = vlc_getaddrinfo( p_this, psz_host, i_port, &hints, &res ); if( i_val ) { - msg_Err( p_this, "cannot resolve %s port %d : %s", psz_host, i_port, + msg_Err( p_this, "cannot resolve [%s]:%d : %s", psz_host, i_port, vlc_gai_strerror( i_val ) ); return -1; } @@ -682,7 +683,7 @@ int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port, #else if( errno == ENETUNREACH ) #endif - b_unreach = VLC_TRUE; + b_unreach = true; else { msg_Warn( p_this, "%s port %d : %m", psz_host, i_port); @@ -878,6 +879,10 @@ int net_SetCSCov (int fd, int sendcov, int recvcov) return VLC_SUCCESS; #endif } +#if !defined( UDPLITE_RECV_CSCOV ) && !defined( DCCP_SOCKOPT_SEND_CSCOV ) + VLC_UNUSED(sendcov); + VLC_UNUSED(recvcov); +#endif return VLC_EGENERIC; }