mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
net: Have LookupNumeric return a CService directly
Also fix up a few small issues: - Lookup with "badip:port" now sets the port to 0 - Don't allow assert to have side-effects
This commit is contained in:
@@ -231,9 +231,14 @@ bool Lookup(const char *pszName, CService& addr, int portDefault, bool fAllowLoo
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LookupNumeric(const char *pszName, CService& addr, int portDefault)
|
||||
CService LookupNumeric(const char *pszName, int portDefault)
|
||||
{
|
||||
return Lookup(pszName, addr, portDefault, false);
|
||||
CService addr;
|
||||
// "1.2:345" will fail to resolve the ip, but will still set the port.
|
||||
// If the ip fails to resolve, re-init the result.
|
||||
if(!Lookup(pszName, addr, portDefault, false))
|
||||
addr = CService();
|
||||
return addr;
|
||||
}
|
||||
|
||||
struct timeval MillisToTimeval(int64_t nTimeout)
|
||||
|
||||
Reference in New Issue
Block a user