mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge #8466: [Trivial] Do not shadow variables in networking code
b7c349d
Do not shadow variables in networking code (Pavel Janík)
This commit is contained in:
commit
cbe9ae8c69
@ -70,7 +70,7 @@ namespace {
|
|||||||
SOCKET socket;
|
SOCKET socket;
|
||||||
bool whitelisted;
|
bool whitelisted;
|
||||||
|
|
||||||
ListenSocket(SOCKET socket, bool whitelisted) : socket(socket), whitelisted(whitelisted) {}
|
ListenSocket(SOCKET _socket, bool _whitelisted) : socket(_socket), whitelisted(_whitelisted) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
src/net.h
12
src/net.h
@ -512,21 +512,21 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
// Known checking here is only to save space from duplicates.
|
||||||
// SendMessages will filter it again for knowns that were added
|
// SendMessages will filter it again for knowns that were added
|
||||||
// after addresses were pushed.
|
// 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) {
|
if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
|
||||||
vAddrToSend[insecure_rand() % vAddrToSend.size()] = addr;
|
vAddrToSend[insecure_rand() % vAddrToSend.size()] = _addr;
|
||||||
} else {
|
} else {
|
||||||
vAddrToSend.push_back(addr);
|
vAddrToSend.push_back(_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,8 +197,8 @@ bool CNetAddr::IsValid() const
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// unspecified IPv6 address (::/128)
|
// unspecified IPv6 address (::/128)
|
||||||
unsigned char ipNone[16] = {};
|
unsigned char ipNone6[16] = {};
|
||||||
if (memcmp(ip, ipNone, 16) == 0)
|
if (memcmp(ip, ipNone6, 16) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// documentation IPv6 address
|
// documentation IPv6 address
|
||||||
|
@ -631,8 +631,8 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest
|
|||||||
|
|
||||||
SplitHostPort(std::string(pszDest), port, strDest);
|
SplitHostPort(std::string(pszDest), port, strDest);
|
||||||
|
|
||||||
proxyType nameProxy;
|
proxyType proxy;
|
||||||
GetNameProxy(nameProxy);
|
GetNameProxy(proxy);
|
||||||
|
|
||||||
std::vector<CService> addrResolved;
|
std::vector<CService> addrResolved;
|
||||||
if (Lookup(strDest.c_str(), addrResolved, port, fNameLookup && !HaveNameProxy(), 256)) {
|
if (Lookup(strDest.c_str(), addrResolved, port, fNameLookup && !HaveNameProxy(), 256)) {
|
||||||
@ -646,7 +646,7 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest
|
|||||||
|
|
||||||
if (!HaveNameProxy())
|
if (!HaveNameProxy())
|
||||||
return false;
|
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)
|
bool LookupSubNet(const char* pszName, CSubNet& ret)
|
||||||
|
@ -29,7 +29,7 @@ class proxyType
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
proxyType(): randomize_credentials(false) {}
|
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(); }
|
bool IsValid() const { return proxy.IsValid(); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user