send hearbeat denied packet back from ice-server

This commit is contained in:
Stephen Birarda 2016-02-23 15:12:17 -08:00
parent bb561e98d0
commit 5fe74bb33c
3 changed files with 7 additions and 3 deletions

View file

@ -52,7 +52,6 @@ IceServer::IceServer(int argc, char* argv[]) :
QTimer* inactivePeerTimer = new QTimer(this); QTimer* inactivePeerTimer = new QTimer(this);
connect(inactivePeerTimer, &QTimer::timeout, this, &IceServer::clearInactivePeers); connect(inactivePeerTimer, &QTimer::timeout, this, &IceServer::clearInactivePeers);
inactivePeerTimer->start(CLEAR_INACTIVE_PEERS_INTERVAL_MSECS); inactivePeerTimer->start(CLEAR_INACTIVE_PEERS_INTERVAL_MSECS);
} }
bool IceServer::packetVersionMatch(const udt::Packet& packet) { bool IceServer::packetVersionMatch(const udt::Packet& packet) {
@ -80,6 +79,10 @@ void IceServer::processPacket(std::unique_ptr<udt::Packet> packet) {
if (peer) { if (peer) {
// so that we can send packets to the heartbeating peer when we need, we need to activate a socket now // so that we can send packets to the heartbeating peer when we need, we need to activate a socket now
peer->activateMatchingOrNewSymmetricSocket(nlPacket->getSenderSockAddr()); peer->activateMatchingOrNewSymmetricSocket(nlPacket->getSenderSockAddr());
} else {
// we couldn't verify this peer - respond back to them so they know they may need to perform keypair re-generation
static auto deniedPacket = NLPacket::create(PacketType::ICEServerHeartbeatDenied);
_serverSocket.writePacket(*deniedPacket, packet->getSenderSockAddr());
} }
} else if (nlPacket->getType() == PacketType::ICEServerQuery) { } else if (nlPacket->getType() == PacketType::ICEServerQuery) {
QDataStream heartbeatStream(nlPacket.get()); QDataStream heartbeatStream(nlPacket.get());

View file

@ -30,7 +30,7 @@ const QSet<PacketType> NON_SOURCED_PACKETS = QSet<PacketType>()
<< PacketType::DomainServerAddedNode << PacketType::DomainServerConnectionToken << PacketType::DomainServerAddedNode << PacketType::DomainServerConnectionToken
<< PacketType::DomainSettingsRequest << PacketType::DomainSettings << PacketType::DomainSettingsRequest << PacketType::DomainSettings
<< PacketType::ICEServerPeerInformation << PacketType::ICEServerQuery << PacketType::ICEServerHeartbeat << PacketType::ICEServerPeerInformation << PacketType::ICEServerQuery << PacketType::ICEServerHeartbeat
<< PacketType::ICEPing << PacketType::ICEPingReply << PacketType::ICEPing << PacketType::ICEPingReply << PacketType::ICEServerHeartbeatDenied
<< PacketType::AssignmentClientStatus << PacketType::StopNode << PacketType::AssignmentClientStatus << PacketType::StopNode
<< PacketType::DomainServerRemovedNode; << PacketType::DomainServerRemovedNode;

View file

@ -90,7 +90,8 @@ public:
DomainServerRemovedNode, DomainServerRemovedNode,
MessagesData, MessagesData,
MessagesSubscribe, MessagesSubscribe,
MessagesUnsubscribe MessagesUnsubscribe,
ICEServerHeartbeatDenied
}; };
}; };