Skip to content

Commit b031137

Browse files
committed
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)
2 parents 108b19f + cd4d3f1 commit b031137

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/net.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,15 +1559,16 @@ void static Discover(boost::thread_group& threadGroup)
15591559

15601560
#ifdef WIN32
15611561
// Get local host IP
1562-
char pszHostName[1000] = "";
1562+
char pszHostName[256] = "";
15631563
if (gethostname(pszHostName, sizeof(pszHostName)) != SOCKET_ERROR)
15641564
{
15651565
vector<CNetAddr> vaddr;
15661566
if (LookupHost(pszHostName, vaddr))
15671567
{
15681568
BOOST_FOREACH (const CNetAddr &addr, vaddr)
15691569
{
1570-
AddLocal(addr, LOCAL_IF);
1570+
if (AddLocal(addr, LOCAL_IF))
1571+
LogPrintf("%s: %s - %s\n", __func__, pszHostName, addr.ToString());
15711572
}
15721573
}
15731574
}
@@ -1587,20 +1588,19 @@ void static Discover(boost::thread_group& threadGroup)
15871588
struct sockaddr_in* s4 = (struct sockaddr_in*)(ifa->ifa_addr);
15881589
CNetAddr addr(s4->sin_addr);
15891590
if (AddLocal(addr, LOCAL_IF))
1590-
LogPrintf("IPv4 %s: %s\n", ifa->ifa_name, addr.ToString());
1591+
LogPrintf("%s: IPv4 %s: %s\n", __func__, ifa->ifa_name, addr.ToString());
15911592
}
15921593
else if (ifa->ifa_addr->sa_family == AF_INET6)
15931594
{
15941595
struct sockaddr_in6* s6 = (struct sockaddr_in6*)(ifa->ifa_addr);
15951596
CNetAddr addr(s6->sin6_addr);
15961597
if (AddLocal(addr, LOCAL_IF))
1597-
LogPrintf("IPv6 %s: %s\n", ifa->ifa_name, addr.ToString());
1598+
LogPrintf("%s: IPv6 %s: %s\n", __func__, ifa->ifa_name, addr.ToString());
15981599
}
15991600
}
16001601
freeifaddrs(myaddrs);
16011602
}
16021603
#endif
1603-
16041604
}
16051605

16061606
void StartNode(boost::thread_group& threadGroup)

0 commit comments

Comments
 (0)