Changeset 209a00c674b57f182fb47fca9b1ad306a7165793

Show
Ignore:
Timestamp:
06/11/06 18:29:07 (2 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1162834147 +0000
git-parent:

[0dc1ef3e1d35207d7ae301ee04e4dea5210694c2]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1162834147 +0000
Message:

Cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/network.h

    r704c851 r209a00c  
    9090VLC_EXPORT( int, __net_ConnectTCP, ( vlc_object_t *p_this, const char *psz_host, int i_port ) ); 
    9191 
    92 int *net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port, 
    93                  int family, int socktype, int protocol); 
     92/*int *net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port, 
     93                                int family, int socktype, int protocol);*/ 
     94VLC_EXPORT( int, net_ListenSingle, (vlc_object_t *p_this, const char *psz_host, int i_port, 
     95                                    int family, int socktype, int protocol) ); 
    9496 
    9597#define net_ListenTCP(a, b, c) __net_ListenTCP(VLC_OBJECT(a), b, c) 
     
    102104VLC_EXPORT( int, __net_ConnectUDP, ( vlc_object_t *p_this, const char *psz_host, int i_port, int hlim ) ); 
    103105 
    104 VLC_EXPORT( int, net_ListenUDP1, (vlc_object_t *obj, const char *host, int port) ); 
     106static inline int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port) 
     107
     108    return net_ListenSingle (obj, host, port, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP); 
     109
    105110 
    106111#define net_OpenUDP(a, b, c, d, e ) __net_OpenUDP(VLC_OBJECT(a), b, c, d, e) 
  • include/vlc_symbols.h

    r704c851 r209a00c  
    555555    char * (*config_ChainCreate_inner) (char **, config_chain_t **, char *); 
    556556    int (*utf8_open_inner) (const char *filename, int flags, mode_t mode); 
    557     int (*net_ListenUDP1_inner) (vlc_object_t *obj, const char *host, int port); 
    558557}; 
    559558# if defined (__PLUGIN__) 
     
    10331032#  define config_ChainCreate (p_symbols)->config_ChainCreate_inner 
    10341033#  define utf8_open (p_symbols)->utf8_open_inner 
    1035 #  define net_ListenUDP1 (p_symbols)->net_ListenUDP1_inner 
    10361034# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) 
    10371035/****************************************************************** 
     
    15141512    ((p_symbols)->config_ChainCreate_inner) = config_ChainCreate; \ 
    15151513    ((p_symbols)->utf8_open_inner) = utf8_open; \ 
    1516     ((p_symbols)->net_ListenUDP1_inner) = net_ListenUDP1; \ 
    15171514    (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ 
    15181515    (p_symbols)->__sout_CfgParse_deprecated = NULL; \ 
  • src/network/io.c

    r8c2241f r209a00c  
    115115 
    116116 
    117 int *net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port, 
    118                  int family, int socktype, int protocol) 
     117static int *net_Listen (vlc_object_t *p_this, const char *psz_host, 
     118                        int i_port, int family, int socktype, int protocol) 
    119119{ 
    120120    struct addrinfo hints, *res; 
     
    234234 
    235235 
     236int net_ListenSingle (vlc_object_t *obj, const char *host, int port, 
     237                      int family, int socktype, int protocol) 
     238{ 
     239    int *fdv = net_Listen (obj, host, port, family, socktype, protocol); 
     240    if (fdv == NULL) 
     241        return -1; 
     242 
     243    for (unsigned i = 1; fdv[i] != -1; i++) 
     244    { 
     245        msg_Warn (obj, "A socket has been dropped!"); 
     246        net_Close (fdv[i]); 
     247    } 
     248 
     249    int fd = fdv[0]; 
     250    assert (fd != -1); 
     251 
     252    free (fdv); 
     253    return fd; 
     254} 
     255 
     256 
     257 
    236258/***************************************************************************** 
    237259 * __net_Close: 
  • src/network/udp.c

    r1ed9a7d r209a00c  
    403403 
    404404 
    405 static inline 
    406 int *__net_ListenUDP (vlc_object_t *obj, const char *host, int port) 
    407 { 
    408     int *fdv = net_Listen (obj, host, port, 0, SOCK_DGRAM, IPPROTO_UDP); 
    409     if (fdv == NULL) 
    410         return NULL; 
    411  
    412     /* FIXME: handle multicast subscription */ 
    413     return fdv; 
    414 } 
    415  
    416  
    417 int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port) 
    418 { 
    419     int *fdv = __net_ListenUDP (obj, host, port); 
    420     if (fdv == NULL) 
    421         return -1; 
    422  
    423     for (unsigned i = 1; fdv[i] != -1; i++) 
    424     { 
    425         msg_Warn (obj, "A socket has been dropped!"); 
    426         net_Close (fdv[i]); 
    427     } 
    428  
    429     int fd = fdv[0]; 
    430     assert (fd != -1); 
    431  
    432     free (fdv); 
    433     return fd; 
    434 } 
    435  
    436  
    437405/***************************************************************************** 
    438406 * __net_OpenUDP: