summaryrefslogtreecommitdiffstats
path: root/examples/network
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-01-17 18:31:39 -0800
committerThiago Macieira <thiago.macieira@intel.com>2018-05-05 06:20:01 +0000
commit2f9d49630d1b250bd8c9bb1202dc113fbb3cb20a (patch)
tree433b5da6b2ef983529a709498d03535d1b0120ef /examples/network
parentba2b7b8e33635f29bae8e9e580b23a544de7727f (diff)
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>
Diffstat (limited to 'examples/network')
-rw-r--r--examples/network/network-chat/peermanager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/network/network-chat/peermanager.cpp b/examples/network/network-chat/peermanager.cpp
index c70cc5e56d..07fd7f2a1a 100644
--- a/examples/network/network-chat/peermanager.cpp
+++ b/examples/network/network-chat/peermanager.cpp
@@ -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;