diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-05-28 16:44:08 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-06-13 23:53:08 +0200 |
commit | 1a5a4e648873c4cd88b936648ebf2858393e5510 (patch) | |
tree | 48e7d68293a0028a0239a441bd8fd276c675a216 /src/netbase.cpp | |
parent | f9f5cfc50637f2cd1540923caf337e2651ec1625 (diff) |
Randomize name lookup result in ConnectSocketByName
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r-- | src/netbase.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index 572ae70871..e2a516986c 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -621,10 +621,10 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest proxyType nameProxy; GetNameProxy(nameProxy); - CService addrResolved; - if (Lookup(strDest.c_str(), addrResolved, port, fNameLookup && !HaveNameProxy())) { - if (addrResolved.IsValid()) { - addr = addrResolved; + std::vector<CService> addrResolved; + if (Lookup(strDest.c_str(), addrResolved, port, fNameLookup && !HaveNameProxy(), 256)) { + if (addrResolved.size() > 0) { + addr = addrResolved[GetRand(addrResolved.size())]; return ConnectSocket(addr, hSocketRet, nTimeout); } } |