Skip to content

Commit

Permalink
Examples: fix network-chat in the presence of an IPv6 stack
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Edward Welbourne <[email protected]>
  • Loading branch information
thiagomacieira committed May 5, 2018
1 parent ba2b7b8 commit 2f9d496
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/network/network-chat/peermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2f9d496

Please sign in to comment.