fix for double ICE connect attempts from domain-server

This commit is contained in:
Stephen Birarda 2014-10-03 15:25:47 -07:00
parent f673ab316a
commit 4e0bb94cdd
2 changed files with 9 additions and 5 deletions

View file

@ -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;
}
}

View file

@ -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 {