diff options
| author | Gavin Andresen <[email protected]> | 2012-01-16 16:45:43 -0500 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2012-01-16 16:45:43 -0500 |
| commit | 8498c591448d01a8a8ccc5ad1e8cbee9dbcf1500 (patch) | |
| tree | 5084f2fedb69b5c3a58e2ea915b27adbf189c0e0 /src/netbase.cpp | |
| parent | Merge pull request #758 from Matoking/master (diff) | |
| parent | Minor code cleanup to use fHaveUPnP instead of #ifdef (diff) | |
| download | discoin-8498c591448d01a8a8ccc5ad1e8cbee9dbcf1500.tar.xz discoin-8498c591448d01a8a8ccc5ad1e8cbee9dbcf1500.zip | |
Merge branch 'keepnode' of https://github.com/TheBlueMatt/bitcoin
Diffstat (limited to 'src/netbase.cpp')
| -rw-r--r-- | src/netbase.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index ca27c2a8c..48db3625c 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -98,7 +98,7 @@ bool LookupHostNumeric(const char *pszName, std::vector<CNetAddr>& vIP, int nMax return LookupHost(pszName, vIP, nMaxSolutions, false); } -bool Lookup(const char *pszName, CService& addr, int portDefault, bool fAllowLookup) +bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, int nMaxSolutions) { if (pszName[0] == 0) return false; @@ -132,10 +132,22 @@ bool Lookup(const char *pszName, CService& addr, int portDefault, bool fAllowLoo } std::vector<CNetAddr> vIP; - bool fRet = LookupIntern(pszHost, vIP, 1, fAllowLookup); + bool fRet = LookupIntern(pszHost, vIP, nMaxSolutions, fAllowLookup); + if (!fRet) + return false; + vAddr.resize(vIP.size()); + for (int i = 0; i < vIP.size(); i++) + vAddr[i] = CService(vIP[i], port); + return true; +} + +bool Lookup(const char *pszName, CService& addr, int portDefault, bool fAllowLookup) +{ + std::vector<CService> vService; + bool fRet = Lookup(pszName, vService, portDefault, fAllowLookup, 1); if (!fRet) return false; - addr = CService(vIP[0], port); + addr = vService[0]; return true; } |