[vlc-commits] net: add vlc_getaddrinfo_i11e() stub

Rémi Denis-Courmont git at videolan.org
Sun Oct 30 21:52:36 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct 30 22:11:08 2016 +0200| [10e0eec473fa4b3f2f204238ed378e8cce3c9a27] | committer: Rémi Denis-Courmont

net: add vlc_getaddrinfo_i11e() stub

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=10e0eec473fa4b3f2f204238ed378e8cce3c9a27
---

 include/vlc_network.h     | 3 ++-
 src/network/getaddrinfo.c | 7 +++++++
 src/network/tcp.c         | 4 ++--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/vlc_network.h b/include/vlc_network.h
index 8779ad2..875ae18 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -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 */
diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
index 5f5d0ef..ecbd367 100644
--- a/src/network/getaddrinfo.c
+++ b/src/network/getaddrinfo.c
@@ -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);
+}
diff --git a/src/network/tcp.c b/src/network/tcp.c
index 6b592e9..4f4d470 100644
--- a/src/network/tcp.c
+++ b/src/network/tcp.c
@@ -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,
@@ -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;



More information about the vlc-commits mailing list