Examples: fix network-chat in the presence of an IPv6 stack

Since we bind to QHostAddress::Any, the incoming packets are actually
IPv4-mapped IPv6 addresses and the operator== strict comparison was
failing. Instead, use isEqual(), which defaults to TolerantComparison.

Change-Id: Ic38ec929fc3f4bb795dafffd150ac6b3a0a7e3b2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2018-01-17 18:31:39 -08:00
parent ba2b7b8e33
commit 2f9d49630d

View File

@ -108,7 +108,7 @@ void PeerManager::startBroadcasting()
bool PeerManager::isLocalHostAddress(const QHostAddress &address)
{
foreach (QHostAddress localAddress, ipAddresses) {
if (address == localAddress)
if (address.isEqual(localAddress))
return true;
}
return false;