diff options
author | Kevin Smith <git@kismith.co.uk> | 2018-06-19 13:57:06 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2018-06-19 15:57:25 (GMT) |
commit | 83434963a7b10b759ffe3fdc1312efdef282a450 (patch) | |
tree | 7cf46b95fc0327cc338259f07e10d609c6ed4c68 /Swiften/Network/StaticDomainNameResolver.cpp | |
parent | ddc60687e44209d136c63776b5dc714791b41436 (diff) | |
download | swift-83434963a7b10b759ffe3fdc1312efdef282a450.zip swift-83434963a7b10b759ffe3fdc1312efdef282a450.tar.bz2 |
Don't double-connect to IP literals
Before this change, an IP literal would be attempted directly, and if
that failed it would then 'resolve' the literal and try the result.
Test-Information:
Added a unit test verifying the bug before fixing it.
Change-Id: Ic887c74152f5a4b259392dad402952b3777268b1
Diffstat (limited to 'Swiften/Network/StaticDomainNameResolver.cpp')
-rw-r--r-- | Swiften/Network/StaticDomainNameResolver.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Swiften/Network/StaticDomainNameResolver.cpp b/Swiften/Network/StaticDomainNameResolver.cpp index 95b3dd9..b8f4c7a 100644 --- a/Swiften/Network/StaticDomainNameResolver.cpp +++ b/Swiften/Network/StaticDomainNameResolver.cpp @@ -50,6 +50,10 @@ namespace { if (!resolver->getIsResponsive()) { return; } + if (auto address = HostAddress::fromString(host)) { + // IP Literals should resolve to themselves + resolver->addAddress(host, *address); + } StaticDomainNameResolver::AddressesMap::const_iterator i = resolver->getAddresses().find(host); if (i != resolver->getAddresses().end()) { eventLoop->postEvent( |