diff options
Diffstat (limited to 'src/modules/netlib')
-rw-r--r-- | src/modules/netlib/netlibopenconn.cpp | 8 | ||||
-rw-r--r-- | src/modules/netlib/netlibsock.cpp | 33 |
2 files changed, 13 insertions, 28 deletions
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 57c83ed507..86fafd0755 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -549,7 +549,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort);
_itoa(nlc->wProxyPort, szPort, 10);
- if (MyGetaddrinfo(nlc->szProxyServer, szPort, &hints, &air)) {
+ if (GetAddrInfoA(nlc->szProxyServer, szPort, &hints, &air)) {
NetlibLogf(nlc->nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "getaddrinfo", nlc->szProxyServer, WSAGetLastError());
return false;
}
@@ -562,7 +562,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) _itoa(nlc->nloc.wPort, szPort, 10);
- if (MyGetaddrinfo(nlc->nloc.szHost, szPort, &hints, &air)) {
+ if (GetAddrInfoA(nlc->nloc.szHost, szPort, &hints, &air)) {
NetlibLogf(nlc->nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "getaddrinfo", nlc->nloc.szHost, WSAGetLastError());
return false;
}
@@ -659,7 +659,7 @@ retry: nlc->s = INVALID_SOCKET;
}
- MyFreeaddrinfo(air);
+ FreeAddrInfoA(air);
notblocking = 0;
if (nlc->s != INVALID_SOCKET) ioctlsocket(nlc->s, FIONBIO, ¬blocking);
@@ -669,7 +669,7 @@ retry: static bool my_connect(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
{
- return MyGetaddrinfo && MyFreeaddrinfo ? my_connectIPv6(nlc, nloc) : my_connectIPv4(nlc, nloc);
+ return my_connectIPv6(nlc, nloc);
}
static int NetlibHttpFallbackToDirect(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index abd947bfc9..2611ea9f37 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -217,33 +217,18 @@ bool NetlibStringToAddress(const char* str, SOCKADDR_INET_M* addr) {
if ( !str) return false;
- if (MyWSAStringToAddress)
- {
- int len = sizeof(SOCKADDR_INET_M);
- return !MyWSAStringToAddress((char*)str, AF_INET6, NULL, (PSOCKADDR)addr, &len);
- }
- else
- {
- unsigned iaddr = inet_addr(str);
- if ( !iaddr) return false;
-
- addr->Ipv4.sin_addr.s_addr = iaddr;
- addr->Ipv4.sin_family = AF_INET;
- return true;
- }
+ int len = sizeof(SOCKADDR_INET_M);
+ return !WSAStringToAddressA((char*)str, AF_INET6, NULL, (PSOCKADDR)addr, &len);
}
char* NetlibAddressToString(SOCKADDR_INET_M* addr)
{
char saddr[128];
- if (MyWSAAddressToString)
- {
- DWORD len = sizeof(saddr);
- if ( !MyWSAAddressToString((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len))
- return mir_strdup(saddr);
- }
- else if (addr->si_family == AF_INET)
+ DWORD len = sizeof(saddr);
+ if ( !WSAAddressToStringA((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len))
+ return mir_strdup(saddr);
+ if (addr->si_family == AF_INET)
{
char *szIp = inet_ntoa(addr->Ipv4.sin_addr);
if (addr->Ipv4.sin_port != 0)
@@ -290,7 +275,7 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_PASSIVE;
- if (MyGetaddrinfo(szMyHost, NULL, &hints, &air))
+ if (GetAddrInfoA(szMyHost, NULL, &hints, &air))
return NULL;
unsigned n = 0;
@@ -320,7 +305,7 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) mir_free(szIp);
}
}
- MyFreeaddrinfo(air);
+ FreeAddrInfoA(air);
return addr;
}
@@ -345,5 +330,5 @@ static NETLIBIPLIST* GetMyIpv4(void) NETLIBIPLIST* GetMyIp(unsigned flags)
{
- return (MyGetaddrinfo && MyFreeaddrinfo) ? GetMyIpv6(flags) : GetMyIpv4();
+ return GetMyIpv6(flags);
}
|