Skip to content

Commit

Permalink
Randomize name lookup result in ConnectSocketByName
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa authored and Fuzzbawls committed May 23, 2020
1 parent cdc1d9f commit 5e79989
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,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);
}
}
Expand Down

0 comments on commit 5e79989

Please sign in to comment.