summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/HostnameLookup.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-02-21 12:19:03 +0100
committerMattes D <github@xoft.cz>2015-02-21 12:19:03 +0100
commit9971670b4062acbae2f7fba57996f0c1e67c7601 (patch)
tree4d3de89abd8ece59ebc30b4fec48089070a76eb3 /src/OSSupport/HostnameLookup.cpp
parentFixed monster spawn randomness. (diff)
parentAPIDump: Added the UDP zero port policy. (diff)
downloadcuberite-9971670b4062acbae2f7fba57996f0c1e67c7601.tar
cuberite-9971670b4062acbae2f7fba57996f0c1e67c7601.tar.gz
cuberite-9971670b4062acbae2f7fba57996f0c1e67c7601.tar.bz2
cuberite-9971670b4062acbae2f7fba57996f0c1e67c7601.tar.lz
cuberite-9971670b4062acbae2f7fba57996f0c1e67c7601.tar.xz
cuberite-9971670b4062acbae2f7fba57996f0c1e67c7601.tar.zst
cuberite-9971670b4062acbae2f7fba57996f0c1e67c7601.zip
Diffstat (limited to 'src/OSSupport/HostnameLookup.cpp')
-rw-r--r--src/OSSupport/HostnameLookup.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/OSSupport/HostnameLookup.cpp b/src/OSSupport/HostnameLookup.cpp
index 3a2997ffd..0944153be 100644
--- a/src/OSSupport/HostnameLookup.cpp
+++ b/src/OSSupport/HostnameLookup.cpp
@@ -69,12 +69,24 @@ void cHostnameLookup::Callback(int a_ErrCode, evutil_addrinfo * a_Addr, void * a
case AF_INET: // IPv4
{
sockaddr_in * sin = reinterpret_cast<sockaddr_in *>(a_Addr->ai_addr);
+ if (!Self->m_Callbacks->OnNameResolvedV4(Self->m_Hostname, sin))
+ {
+ // Callback indicated that the IP shouldn't be serialized to a string, just continue with the next address:
+ HasResolved = true;
+ continue;
+ }
evutil_inet_ntop(AF_INET, &(sin->sin_addr), IP, sizeof(IP));
break;
}
case AF_INET6: // IPv6
{
sockaddr_in6 * sin = reinterpret_cast<sockaddr_in6 *>(a_Addr->ai_addr);
+ if (!Self->m_Callbacks->OnNameResolvedV6(Self->m_Hostname, sin))
+ {
+ // Callback indicated that the IP shouldn't be serialized to a string, just continue with the next address:
+ HasResolved = true;
+ continue;
+ }
evutil_inet_ntop(AF_INET6, &(sin->sin6_addr), IP, sizeof(IP));
break;
}