Skip to content

Commit

Permalink
Merge pull request #2408 from Pythonix/netbase-fixes
Browse files Browse the repository at this point in the history
refactor: Pass values by reference
  • Loading branch information
jamescowens committed Dec 10, 2021
2 parents 07ff18b + 4545703 commit 43d9b07
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ CNode* FindNode(const CNetAddr& ip)
return nullptr;
}

CNode* FindNode(std::string addrName)
CNode* FindNode(const std::string& addrName)
{
LOCK(cs_vNodes);
for (auto const& pnode : vNodes) {
Expand Down
4 changes: 2 additions & 2 deletions src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
return true;
}

bool SetProxy(enum Network net, CService addrProxy) {
bool SetProxy(enum Network net, const CService &addrProxy) {
assert(net >= 0 && net < NET_MAX);
if (!addrProxy.IsValid())
return false;
Expand All @@ -397,7 +397,7 @@ bool GetProxy(enum Network net, proxyType &proxyInfoOut) {
return true;
}

bool SetNameProxy(CService addrProxy) {
bool SetNameProxy(const CService &addrProxy) {
if (!addrProxy.IsValid())
return false;
LOCK(cs_proxyInfos);
Expand Down
8 changes: 4 additions & 4 deletions src/netbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ class CService : public CNetAddr
typedef CService proxyType;

enum Network ParseNetwork(std::string net);
bool SetProxy(enum Network net, CService addrProxy);
bool GetProxy(enum Network net, proxyType &proxyInfoOut);
bool IsProxy(const CNetAddr &addr);
bool SetNameProxy(CService addrProxy);
bool SetProxy(enum Network net, const CService& addrProxy);
bool GetProxy(enum Network net, proxyType& proxyInfoOut);
bool IsProxy(const CNetAddr& addr);
bool SetNameProxy(const CService& addrProxy);
bool HaveNameProxy();
bool LookupHost(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions = 0, bool fAllowLookup = true);
bool Lookup(const char *pszName, CService& addr, int portDefault = 0, bool fAllowLookup = true);
Expand Down

0 comments on commit 43d9b07

Please sign in to comment.