summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/HostnameLookup.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2015-03-09 22:39:11 +0100
committerHowaner <franzi.moos@googlemail.com>2015-03-09 22:39:11 +0100
commita96c21fc0d4326ffda93cc78c5dfcfc4bd034e24 (patch)
tree38dba8f86163283d90d1d6d9d2fa420cb4e99231 /src/OSSupport/HostnameLookup.cpp
parentReadded old comment (diff)
parentFixed client kick/crash if many block changes happend (diff)
downloadcuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.gz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.bz2
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.lz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.xz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.zst
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.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;
}