From c981d768b3cb0cf0879b3d70d3b548692fff0882 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 17 Jan 2012 02:12:35 +0100 Subject: Fix handling of default ports --- src/netbase.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/netbase.cpp') diff --git a/src/netbase.cpp b/src/netbase.cpp index 48db3625c0..54e3119153 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -627,11 +627,12 @@ CService::CService(const char *pszIpPort, bool fAllowLookup) *this = ip; } -CService::CService(const char *pszIp, int portIn, bool fAllowLookup) +CService::CService(const char *pszIpPort, int portDefault, bool fAllowLookup) { - std::vector 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) @@ -642,11 +643,12 @@ 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 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 -- cgit v1.2.3