From 4e0bb94cdd69f703d38d3ddfc5639042aef9a1b1 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 3 Oct 2014 15:25:47 -0700 Subject: [PATCH] fix for double ICE connect attempts from domain-server --- domain-server/src/DomainServer.cpp | 12 +++++++----- libraries/networking/src/NetworkPeer.cpp | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 2a7c818125..452d9d35b7 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -1027,7 +1027,7 @@ void DomainServer::sendICEPingPackets() { } else { // send ping packets to this peer's interfaces qDebug() << "Sending ping packets to establish connectivity with ICE peer with ID" - << peer->getUUID(); + << peer->getUUID(); // send the ping packet to the local and public sockets for this node QByteArray localPingPacket = nodeList->constructPingPacket(PingType::Local, false); @@ -1055,11 +1055,13 @@ void DomainServer::processICEHeartbeatResponse(const QByteArray& packet) { while (!iceResponseStream.atEnd()) { iceResponseStream >> receivedPeer; - if (!_connectingICEPeers.contains(receivedPeer.getUUID()) && !_connectedICEPeers.contains(receivedPeer.getUUID())) { - qDebug() << "New peer requesting connection being added to hash -" << receivedPeer; + if (!_connectedICEPeers.contains(receivedPeer.getUUID())) { + if (!_connectingICEPeers.contains(receivedPeer.getUUID())) { + qDebug() << "New peer requesting connection being added to hash -" << receivedPeer; + } + + _connectingICEPeers[receivedPeer.getUUID()] = receivedPeer; } - - _connectingICEPeers[receivedPeer.getUUID()] = receivedPeer; } } diff --git a/libraries/networking/src/NetworkPeer.cpp b/libraries/networking/src/NetworkPeer.cpp index d458f579c1..eaaf57471c 100644 --- a/libraries/networking/src/NetworkPeer.cpp +++ b/libraries/networking/src/NetworkPeer.cpp @@ -46,6 +46,7 @@ NetworkPeer::NetworkPeer(const NetworkPeer& otherPeer) { _wakeTimestamp = otherPeer._wakeTimestamp; _lastHeardMicrostamp = otherPeer._lastHeardMicrostamp; + _connectionAttempts = otherPeer._connectionAttempts; } NetworkPeer& NetworkPeer::operator=(const NetworkPeer& otherPeer) { @@ -62,6 +63,7 @@ void NetworkPeer::swap(NetworkPeer& otherPeer) { swap(_localSocket, otherPeer._localSocket); swap(_wakeTimestamp, otherPeer._wakeTimestamp); swap(_lastHeardMicrostamp, otherPeer._lastHeardMicrostamp); + swap(_connectionAttempts, otherPeer._connectionAttempts); } QByteArray NetworkPeer::toByteArray() const {