// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2011 The Bitcoin developers
+// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
*this = ip;
}
-CService::CService(const char *pszIp, int portIn, bool fAllowLookup)
+CService::CService(const char *pszIpPort, int portDefault, bool fAllowLookup)
{
- std::vector<CNetAddr> ip;
- if (LookupHost(pszIp, ip, 1, fAllowLookup))
- *this = CService(ip[0], portIn);
+ Init();
+ CService ip;
+ if (Lookup(pszIpPort, ip, portDefault, fAllowLookup))
+ *this = ip;
}
CService::CService(const std::string &strIpPort, bool fAllowLookup)
*this = ip;
}
-CService::CService(const std::string &strIp, int portIn, bool fAllowLookup)
+CService::CService(const std::string &strIpPort, int portDefault, bool fAllowLookup)
{
- std::vector<CNetAddr> ip;
- if (LookupHost(strIp.c_str(), ip, 1, fAllowLookup))
- *this = CService(ip[0], portIn);
+ Init();
+ CService ip;
+ if (Lookup(strIpPort.c_str(), ip, portDefault, fAllowLookup))
+ *this = ip;
}
unsigned short CService::GetPort() const