re-send heartbeat to ICE server after max connection attempts

This commit is contained in:
Stephen Birarda 2014-10-03 09:47:15 -07:00
parent d9e0c91e02
commit 55a7180838
2 changed files with 8 additions and 2 deletions

View file

@ -59,7 +59,7 @@ public:
bool requiresICE() const { return !_iceServerSockAddr.isNull(); } bool requiresICE() const { return !_iceServerSockAddr.isNull(); }
const HifiSockAddr& getICEServerSockAddr() const { return _iceServerSockAddr; } const HifiSockAddr& getICEServerSockAddr() const { return _iceServerSockAddr; }
const NetworkPeer& getICEPeer() const { return _icePeer; } NetworkPeer& getICEPeer() const { return _icePeer; }
void activateICELocalSocket(); void activateICELocalSocket();
void activateICEPublicSocket(); void activateICEPublicSocket();

View file

@ -335,7 +335,11 @@ void NodeList::sendDomainServerCheckIn() {
} }
void NodeList::handleICEConnectionToDomainServer() { void NodeList::handleICEConnectionToDomainServer() {
if (_domainHandler.getICEPeer().isNull()) { if (_domainHandler.getICEPeer().isNull()
|| _domainHandler.getICEPeer().getConnectionAttempts() >= MAX_ICE_CONNECTION_ATTEMPTS) {
_domainHandler.getICEPeer().resetConnectionAttemps();
LimitedNodeList::sendHeartbeatToIceServer(_domainHandler.getICEServerSockAddr(), LimitedNodeList::sendHeartbeatToIceServer(_domainHandler.getICEServerSockAddr(),
_domainHandler.getICEClientID(), _domainHandler.getICEClientID(),
_domainHandler.getUUID()); _domainHandler.getUUID());
@ -349,6 +353,8 @@ void NodeList::handleICEConnectionToDomainServer() {
QByteArray publicPingPacket = constructPingPacket(PingType::Public, false, _domainHandler.getICEClientID()); QByteArray publicPingPacket = constructPingPacket(PingType::Public, false, _domainHandler.getICEClientID());
writeUnverifiedDatagram(publicPingPacket, _domainHandler.getICEPeer().getPublicSocket()); writeUnverifiedDatagram(publicPingPacket, _domainHandler.getICEPeer().getPublicSocket());
_domainHandler.getICEPeer().incrementConnectionAttempts();
} }
} }