Skip to content

Commit

Permalink
net: add vlc_getaddrinfo_i11e() stub
Browse files Browse the repository at this point in the history
The function should provide interrupt DNS resolution, so a thread can
abort a DNS query (e.g. if network is down or really slow).

The stub is not interruptible. This makes no difference to the existing
uninterruptible (mis)behaviour.
  • Loading branch information
Rémi Denis-Courmont committed Oct 30, 2016
1 parent dd8756a commit 10e0eec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/vlc_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ VLC_API int getnameinfo ( const struct sockaddr *, socklen_t,
VLC_API int vlc_getnameinfo( const struct sockaddr *, int, char *, int, int *, int );
VLC_API int vlc_getaddrinfo (const char *, unsigned,
const struct addrinfo *, struct addrinfo **);

int vlc_getaddrinfo_i11e(const char *, unsigned, const struct addrinfo *,
struct addrinfo **);

#ifdef __OS2__
/* OS/2 does not support IPv6, yet. But declare these only for compilation */
Expand Down
7 changes: 7 additions & 0 deletions src/network/getaddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,10 @@ int vlc_getaddrinfo (const char *node, unsigned port,

return getaddrinfo (node, servname, hints, res);
}

#warning vlc_getaddr_info_i11e() not implemented!
int vlc_getaddrinfo_i11e(const char *node, unsigned port,
const struct addrinfo *hints, struct addrinfo **res)
{
return vlc_getaddrinfo(node, port, hints, res);
}
4 changes: 2 additions & 2 deletions src/network/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
.ai_flags = AI_NUMERICSERV | AI_IDN,
}, *res;

int val = vlc_getaddrinfo (psz_realhost, i_realport, &hints, &res);
int val = vlc_getaddrinfo_i11e(psz_realhost, i_realport, &hints, &res);
if (val)
{
msg_Err (p_this, "cannot resolve %s port %d : %s", psz_realhost,
Expand Down Expand Up @@ -435,7 +435,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
};
struct addrinfo *res;

if (vlc_getaddrinfo (psz_host, 0, &hints, &res))
if (vlc_getaddrinfo_i11e(psz_host, 0, &hints, &res))
return VLC_EGENERIC;

buffer[0] = i_socks_version;
Expand Down

0 comments on commit 10e0eec

Please sign in to comment.