diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-05-15 16:50:28 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-05-15 16:50:28 +0200 |
commit | 85663f2c1886cf867ebe8c5b11b5d8fea10f6e82 (patch) | |
tree | 709ace81b3c651883dc4d6115f2d84ac8b013b5e /core/src | |
parent | 6a8062a30d0977118dd378d5a2ef31b40b260165 (diff) |
update to bitcoin-git
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/net.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/src/net.cpp b/core/src/net.cpp index 4f489fdb57..1320781cb2 100644 --- a/core/src/net.cpp +++ b/core/src/net.cpp @@ -133,6 +133,8 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet) bool Lookup(const char *pszName, vector<CAddress>& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup, int portDefault, bool fAllowPort) { vaddr.clear(); + if (pszName[0] == 0) + return false; int port = portDefault; char psz[256]; char *pszHost = psz; @@ -158,11 +160,11 @@ bool Lookup(const char *pszName, vector<CAddress>& vaddr, int nServices, int nMa } } - struct in_addr addrIP; - if (inet_aton(pszHost, &addrIP)) + unsigned int addrIP = inet_addr(pszHost); + if (addrIP != INADDR_NONE) { // valid IP address passed - vaddr.push_back(CAddress(addrIP.s_addr, port, nServices)); + vaddr.push_back(CAddress(addrIP, port, nServices)); return true; } @@ -1527,7 +1529,7 @@ void StartNode(void* parg) if (gethostname(pszHostName, sizeof(pszHostName)) != SOCKET_ERROR) { vector<CAddress> vaddr; - if (NameLookup(pszHostName, vaddr, nLocalServices)) + if (Lookup(pszHostName, vaddr, nLocalServices, -1, true)) BOOST_FOREACH (const CAddress &addr, vaddr) if (addr.GetByte(3) != 127) { |