diff options
author | rubidium <rubidium@openttd.org> | 2009-04-03 09:07:16 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-03 09:07:16 +0000 |
commit | dccfba6e20cdc4bb6d068f075e9b6d7fefee0fb0 (patch) | |
tree | 344540fa511b17f15af59a39a41c98460ffcda9f /src/network/core/host.cpp | |
parent | 632d74c6b1a17f3bc3419158dfc1bb5a2e5f77b5 (diff) | |
download | openttd-dccfba6e20cdc4bb6d068f075e9b6d7fefee0fb0.tar.xz |
(svn r15924) -Codechange: replace NetworkResolveHost with something less AF dependant.
Diffstat (limited to 'src/network/core/host.cpp')
-rw-r--r-- | src/network/core/host.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp index bcd317f8c..4f83c1b37 100644 --- a/src/network/core/host.cpp +++ b/src/network/core/host.cpp @@ -204,50 +204,4 @@ void NetworkFindBroadcastIPs(uint32 *broadcast, int limit) } } - -/** - * Resolve a hostname to an ip. - * @param hsotname the hostname to resolve - * @return the IP belonging to that hostname, or 0 on failure. - */ -uint32 NetworkResolveHost(const char *hostname) -{ - /* Is this an IP address? */ - in_addr_t ip = inet_addr(hostname); - - if (ip != INADDR_NONE) return ip; - - /* No, try to resolve the name */ - struct in_addr addr; -#if !defined(PSP) - struct hostent *he = gethostbyname(hostname); - if (he == NULL) { - DEBUG(net, 0, "[NET] Cannot resolve %s", hostname); - return 0; - } - addr = *(struct in_addr *)he->h_addr_list[0]; -#else - int rid = -1; - char buf[1024]; - - /* Create a resolver */ - if (sceNetResolverCreate(&rid, buf, sizeof(buf)) < 0) { - DEBUG(net, 0, "[NET] Error connecting resolver"); - return 0; - } - - /* Try to resolve the name */ - if (sceNetResolverStartNtoA(rid, hostname, &addr, 2, 3) < 0) { - DEBUG(net, 0, "[NET] Cannot resolve %s", hostname); - sceNetResolverDelete(rid); - return 0; - } - sceNetResolverDelete(rid); -#endif /* PSP */ - - DEBUG(net, 1, "[NET] Resolved %s to %s", hostname, inet_ntoa(addr)); - ip = addr.s_addr; - return ip; -} - #endif /* ENABLE_NETWORK */ |