Skip to content

Commit

Permalink
net: remove now-unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
theuni committed Sep 18, 2017
1 parent 45fd754 commit b887676
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
41 changes: 0 additions & 41 deletions src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,47 +558,6 @@ bool ConnectThroughProxy(const proxyType &proxy, const std::string& strDest, int
hSocketRet = hSocket;
return true;
}

bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout, bool *outProxyConnectionFailed)
{
proxyType proxy;
if (outProxyConnectionFailed)
*outProxyConnectionFailed = false;

if (GetProxy(addrDest.GetNetwork(), proxy))
return ConnectThroughProxy(proxy, addrDest.ToStringIP(), addrDest.GetPort(), hSocketRet, nTimeout, outProxyConnectionFailed);
else // no proxy needed (none set for target network)
return ConnectSocketDirectly(addrDest, hSocketRet, nTimeout);
}

bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, int portDefault, int nTimeout, bool *outProxyConnectionFailed)
{
std::string strDest;
int port = portDefault;

if (outProxyConnectionFailed)
*outProxyConnectionFailed = false;

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

proxyType proxy;
GetNameProxy(proxy);

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);
}
}

addr = CService();

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

bool LookupSubNet(const char* pszName, CSubNet& ret)
{
std::string strSubnet(pszName);
Expand Down
2 changes: 0 additions & 2 deletions src/netbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ bool Lookup(const char *pszName, CService& addr, int portDefault, bool fAllowLoo
bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions);
CService LookupNumeric(const char *pszName, int portDefault = 0);
bool LookupSubNet(const char *pszName, CSubNet& subnet);
bool ConnectSocket(const CService &addr, SOCKET& hSocketRet, int nTimeout, bool *outProxyConnectionFailed = nullptr);
bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, int portDefault, int nTimeout, bool *outProxyConnectionFailed = nullptr);
bool ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRet, int nTimeout);
bool ConnectThroughProxy(const proxyType &proxy, const std::string& strDest, int port, SOCKET& hSocketRet, int nTimeout, bool *outProxyConnectionFailed);
/** Return readable error string for a network error code */
Expand Down

0 comments on commit b887676

Please sign in to comment.