Mercurial > hg > bitcoin
changeset 2797:2ce3b09cb9d8 draft
Fix netbase tests
* Do not rely on "a.b.c" being interpreted as "a.0.b.c"
* Parse numeric addresses for address families for which no device is configured
author | Pieter Wuille <pieter.wuille@gmail.com> |
---|---|
date | Tue, 19 Jun 2012 02:22:09 +0200 |
parents | aeb039c3cf49 |
children | 9ec87d29aebb 72f98941c25b |
files | src/netbase.cpp src/test/netbase_tests.cpp |
diffstat | 2 files changed, 2 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -65,19 +65,17 @@ #ifdef WIN32 # ifdef USE_IPV6 aiHint.ai_family = AF_UNSPEC; - aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST; # else aiHint.ai_family = AF_INET; +# endif aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST; -# endif #else # ifdef USE_IPV6 aiHint.ai_family = AF_UNSPEC; - aiHint.ai_flags = AI_ADDRCONFIG | (fAllowLookup ? 0 : AI_NUMERICHOST); # else aiHint.ai_family = AF_INET; - aiHint.ai_flags = AI_ADDRCONFIG | (fAllowLookup ? 0 : AI_NUMERICHOST); # endif + aiHint.ai_flags = fAllowLookup ? AI_ADDRCONFIG : AI_NUMERICHOST; #endif struct addrinfo *aiRes = NULL; int nErr = getaddrinfo(pszName, NULL, &aiHint, &aiRes);
--- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -86,7 +86,6 @@ BOOST_CHECK(TestParse("[::]:8333", "[::]:8333")); BOOST_CHECK(TestParse("[127.0.0.1]", "127.0.0.1:65535")); BOOST_CHECK(TestParse(":::", "")); - BOOST_CHECK(TestParse("128.5.1", "128.5.0.1:65535")); } BOOST_AUTO_TEST_SUITE_END()