diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-11-26 14:32:09 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-11-26 14:36:50 +0100 |
commit | b031137977c229a2f1c62036c3fd2e72e60efcd0 (patch) | |
tree | 0a7d7a927514a2e8e5047e2533dd71943e917939 /src | |
parent | 108b19f7ef7f9d0bf6c6794bf2be9a12b4cb6400 (diff) | |
parent | cd4d3f1915f56278d83ca00d7a970d08970f2fa4 (diff) |
Merge pull request #5273
cd4d3f1 Win32: change buffer size for gethotsname in Discover() (Philip Kaufmann)
8fa0494 Win32: log addresses found in Discover() calls (Philip Kaufmann)
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/net.cpp b/src/net.cpp index a66875a894..6bf72d22c5 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1559,7 +1559,7 @@ void static Discover(boost::thread_group& threadGroup) #ifdef WIN32 // Get local host IP - char pszHostName[1000] = ""; + char pszHostName[256] = ""; if (gethostname(pszHostName, sizeof(pszHostName)) != SOCKET_ERROR) { vector<CNetAddr> vaddr; @@ -1567,7 +1567,8 @@ void static Discover(boost::thread_group& threadGroup) { BOOST_FOREACH (const CNetAddr &addr, vaddr) { - AddLocal(addr, LOCAL_IF); + if (AddLocal(addr, LOCAL_IF)) + LogPrintf("%s: %s - %s\n", __func__, pszHostName, addr.ToString()); } } } @@ -1587,20 +1588,19 @@ void static Discover(boost::thread_group& threadGroup) struct sockaddr_in* s4 = (struct sockaddr_in*)(ifa->ifa_addr); CNetAddr addr(s4->sin_addr); if (AddLocal(addr, LOCAL_IF)) - LogPrintf("IPv4 %s: %s\n", ifa->ifa_name, addr.ToString()); + LogPrintf("%s: IPv4 %s: %s\n", __func__, ifa->ifa_name, addr.ToString()); } else if (ifa->ifa_addr->sa_family == AF_INET6) { struct sockaddr_in6* s6 = (struct sockaddr_in6*)(ifa->ifa_addr); CNetAddr addr(s6->sin6_addr); if (AddLocal(addr, LOCAL_IF)) - LogPrintf("IPv6 %s: %s\n", ifa->ifa_name, addr.ToString()); + LogPrintf("%s: IPv6 %s: %s\n", __func__, ifa->ifa_name, addr.ToString()); } } freeifaddrs(myaddrs); } #endif - } void StartNode(boost::thread_group& threadGroup) |