Skip to content

Commit

Permalink
Do not shadow variables in networking code
Browse files Browse the repository at this point in the history
  • Loading branch information
paveljanik committed Aug 15, 2016
1 parent 1030fa7 commit b7c349d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace {
SOCKET socket;
bool whitelisted;

ListenSocket(SOCKET socket, bool whitelisted) : socket(socket), whitelisted(whitelisted) {}
ListenSocket(SOCKET _socket, bool _whitelisted) : socket(_socket), whitelisted(_whitelisted) {}
};
}

Expand Down
12 changes: 6 additions & 6 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,21 +509,21 @@ class CNode



void AddAddressKnown(const CAddress& addr)
void AddAddressKnown(const CAddress& _addr)
{
addrKnown.insert(addr.GetKey());
addrKnown.insert(_addr.GetKey());
}

void PushAddress(const CAddress& addr)
void PushAddress(const CAddress& _addr)
{
// Known checking here is only to save space from duplicates.
// SendMessages will filter it again for knowns that were added
// after addresses were pushed.
if (addr.IsValid() && !addrKnown.contains(addr.GetKey())) {
if (_addr.IsValid() && !addrKnown.contains(_addr.GetKey())) {
if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
vAddrToSend[insecure_rand() % vAddrToSend.size()] = addr;
vAddrToSend[insecure_rand() % vAddrToSend.size()] = _addr;
} else {
vAddrToSend.push_back(addr);
vAddrToSend.push_back(_addr);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/netaddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ bool CNetAddr::IsValid() const
return false;

// unspecified IPv6 address (::/128)
unsigned char ipNone[16] = {};
if (memcmp(ip, ipNone, 16) == 0)
unsigned char ipNone6[16] = {};
if (memcmp(ip, ipNone6, 16) == 0)
return false;

// documentation IPv6 address
Expand Down
6 changes: 3 additions & 3 deletions src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest

SplitHostPort(std::string(pszDest), port, strDest);

proxyType nameProxy;
GetNameProxy(nameProxy);
proxyType proxy;
GetNameProxy(proxy);

std::vector<CService> addrResolved;
if (Lookup(strDest.c_str(), addrResolved, port, fNameLookup && !HaveNameProxy(), 256)) {
Expand All @@ -646,7 +646,7 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest

if (!HaveNameProxy())
return false;
return ConnectThroughProxy(nameProxy, strDest, port, hSocketRet, nTimeout, outProxyConnectionFailed);
return ConnectThroughProxy(proxy, strDest, port, hSocketRet, nTimeout, outProxyConnectionFailed);
}

bool LookupSubNet(const char* pszName, CSubNet& ret)
Expand Down
2 changes: 1 addition & 1 deletion src/netbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class proxyType
{
public:
proxyType(): randomize_credentials(false) {}
proxyType(const CService &proxy, bool randomize_credentials=false): proxy(proxy), randomize_credentials(randomize_credentials) {}
proxyType(const CService &_proxy, bool _randomize_credentials=false): proxy(_proxy), randomize_credentials(_randomize_credentials) {}

bool IsValid() const { return proxy.IsValid(); }

Expand Down

0 comments on commit b7c349d

Please sign in to comment.