From 0dd16cfc1ec1ae993b7e6fbce8397f4e6fe9c211 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 18 Oct 2013 15:27:35 -0700 Subject: [PATCH] debug a STUN reponse that only changes port --- libraries/shared/src/NodeList.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/shared/src/NodeList.cpp b/libraries/shared/src/NodeList.cpp index 50f0367d2c..c60898253b 100644 --- a/libraries/shared/src/NodeList.cpp +++ b/libraries/shared/src/NodeList.cpp @@ -409,7 +409,7 @@ void NodeList::processSTUNResponse(unsigned char* packetData, size_t dataBytes) uint16_t xorMappedPort = 0; memcpy(&xorMappedPort, packetData + byteIndex, sizeof(xorMappedPort)); - _publicPort = ntohs(xorMappedPort) ^ (ntohl(RFC_5389_MAGIC_COOKIE_NETWORK_ORDER) >> 16); + uint16_t newPublicPort = ntohs(xorMappedPort) ^ (ntohl(RFC_5389_MAGIC_COOKIE_NETWORK_ORDER) >> 16); byteIndex += sizeof(xorMappedPort); @@ -421,8 +421,9 @@ void NodeList::processSTUNResponse(unsigned char* packetData, size_t dataBytes) QHostAddress newPublicAddress = QHostAddress(stunAddress); - if (newPublicAddress != _publicAddress) { + if (newPublicAddress != _publicAddress || newPublicPort != _publicPort) { _publicAddress = newPublicAddress; + _publicPort = newPublicPort; qDebug("New public socket received from STUN server is %s:%hu\n", _publicAddress.toString().toLocal8Bit().constData(),