handle stun response in assigned clients

This commit is contained in:
Stephen Birarda 2013-10-16 16:37:24 -07:00
parent 224b0d9671
commit 747175311f
4 changed files with 9 additions and 7 deletions

View file

@ -186,7 +186,8 @@ void Agent::run() {
qDebug() << "Uncaught exception at line" << line << ":" << engine.uncaughtException().toString() << "\n";
}
while (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)) {
while (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)
&& packetVersionMatch(receivedData)) {
if (!firstDomainCheckIn && receivedData[0] == PACKET_TYPE_DOMAIN) {
firstDomainCheckIn = true;
}

View file

@ -399,9 +399,8 @@ void AudioMixer::run() {
// give the new audio data to the matching injector node
nodeList->updateNodeWithData(matchingInjector, packetData, receivedBytes);
} else if (packetData[0] == PACKET_TYPE_PING || packetData[0] == PACKET_TYPE_DOMAIN) {
// If the packet is a ping, let processNodeData handle it.
} else {
// let processNodeData handle it.
nodeList->processNodeData(nodeAddress, packetData, receivedBytes);
}
}

View file

@ -614,7 +614,7 @@ int DomainServer::run() {
int numHeaderBytes = populateTypeAndVersion(broadcastPacket, PACKET_TYPE_CREATE_ASSIGNMENT);
int numAssignmentBytes = assignmentToDeploy->packToBuffer(broadcastPacket + numHeaderBytes);
nodeList->getNodeSocket()->send((sockaddr*) &nodePublicAddress,
nodeList->getNodeSocket()->send((sockaddr*) &senderAddress,
broadcastPacket,
numHeaderBytes + numAssignmentBytes);
}

View file

@ -398,8 +398,10 @@ void VoxelServer::run() {
nodeData->initializeVoxelSendThread(this);
}
} else if (packetData[0] == PACKET_TYPE_PING) {
// If the packet is a ping, let processNodeData handle it.
} else if (packetData[0] == PACKET_TYPE_PING
|| packetData[0] == PACKET_TYPE_DOMAIN
|| packetData[0] == PACKET_TYPE_STUN_RESPONSE) {
// let processNodeData handle it.
NodeList::getInstance()->processNodeData(&senderAddress, packetData, packetLength);
} else if (packetData[0] == PACKET_TYPE_DOMAIN) {
NodeList::getInstance()->processNodeData(&senderAddress, packetData, packetLength);