From 5e106d2f19fd30a4b0883c7764879259fe53a43e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 31 Jul 2019 22:15:29 -0700 Subject: [PATCH] Only store the local address from mDNS if it actually worked --- app/backend/computermanager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/backend/computermanager.cpp b/app/backend/computermanager.cpp index e603e4dd..e26a1c2f 100644 --- a/app/backend/computermanager.cpp +++ b/app/backend/computermanager.cpp @@ -665,7 +665,12 @@ private: // Update addresses depending on the context if (m_Mdns) { - newComputer->localAddress = m_Address; + // Only update local address if we actually reached the PC via this address. + // If we reached it via the IPv6 address after the local address failed, + // don't store the non-working local address. + if (http.address() == m_Address) { + newComputer->localAddress = m_Address; + } // Get the WAN IP address using STUN if we're on mDNS over IPv4 if (QHostAddress(newComputer->localAddress).protocol() == QAbstractSocket::IPv4Protocol) {