mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
Merge branch 'atp' of https://github.com/birarda/hifi into protocol
This commit is contained in:
commit
b60e358a68
5 changed files with 25 additions and 26 deletions
|
@ -250,7 +250,7 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
|||
|
||||
QUuid nodeUUID = i.key();
|
||||
SingleSenderStats nodeStats = i.value();
|
||||
|
||||
|
||||
// check if this node is still alive. Remove its stats if it's dead.
|
||||
if (!isAlive(nodeUUID)) {
|
||||
i = _singleSenderStats.erase(i);
|
||||
|
@ -260,7 +260,7 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
|||
// if there are packets from _node that are waiting to be processed,
|
||||
// don't send a NACK since the missing packets may be among those waiting packets.
|
||||
if (hasPacketsToProcessFrom(nodeUUID)) {
|
||||
i++;
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -290,6 +290,8 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
|||
// send the list of nack packets
|
||||
nodeList->sendPacketList(nackPacketList, *destinationNode);
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
return packetsSent;
|
||||
|
|
|
@ -374,21 +374,11 @@ const NLPacket* OctreeQueryNode::getNextNackedPacket() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void OctreeQueryNode::parseNackPacket(const QByteArray& packet) {
|
||||
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(packet);
|
||||
const unsigned char* dataAt = reinterpret_cast<const unsigned char*>(packet.data()) + numBytesPacketHeader;
|
||||
|
||||
// TODO: This no longer has the number of sequence numbers - just read to the end of the packet in sequence number blocks
|
||||
|
||||
// read number of sequence numbers
|
||||
uint16_t numSequenceNumbers = (*(uint16_t*)dataAt);
|
||||
dataAt += sizeof(uint16_t);
|
||||
|
||||
void OctreeQueryNode::parseNackPacket(NLPacket& packet) {
|
||||
// read sequence numbers
|
||||
for (int i = 0; i < numSequenceNumbers; i++) {
|
||||
OCTREE_PACKET_SEQUENCE sequenceNumber = (*(OCTREE_PACKET_SEQUENCE*)dataAt);
|
||||
while (packet.bytesLeftToRead()) {
|
||||
OCTREE_PACKET_SEQUENCE sequenceNumber;
|
||||
packet.readPrimitive(&sequenceNumber);
|
||||
_nackedSequenceNumbers.enqueue(sequenceNumber);
|
||||
dataAt += sizeof(OCTREE_PACKET_SEQUENCE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
OCTREE_PACKET_SEQUENCE getSequenceNumber() const { return _sequenceNumber; }
|
||||
|
||||
void parseNackPacket(const QByteArray& packet);
|
||||
void parseNackPacket(NLPacket& packet);
|
||||
bool hasNextNackedPacket() const;
|
||||
const NLPacket* getNextNackedPacket();
|
||||
|
||||
|
|
|
@ -813,14 +813,16 @@ void OctreeServer::parsePayload() {
|
|||
}
|
||||
|
||||
void OctreeServer::handleOctreeQueryPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode) {
|
||||
// If we got a query packet, then we're talking to an agent, and we
|
||||
// need to make sure we have it in our nodeList.
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->updateNodeWithDataFromPacket(packet, senderNode);
|
||||
|
||||
OctreeQueryNode* nodeData = dynamic_cast<OctreeQueryNode*>(senderNode->getLinkedData());
|
||||
if (nodeData && !nodeData->isOctreeSendThreadInitalized()) {
|
||||
nodeData->initializeOctreeSendThread(this, senderNode);
|
||||
if (!_isFinished) {
|
||||
// If we got a query packet, then we're talking to an agent, and we
|
||||
// need to make sure we have it in our nodeList.
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->updateNodeWithDataFromPacket(packet, senderNode);
|
||||
|
||||
OctreeQueryNode* nodeData = dynamic_cast<OctreeQueryNode*>(senderNode->getLinkedData());
|
||||
if (nodeData && !nodeData->isOctreeSendThreadInitalized()) {
|
||||
nodeData->initializeOctreeSendThread(this, senderNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -829,7 +831,7 @@ void OctreeServer::handleOctreeDataNackPacket(QSharedPointer<NLPacket> packet, S
|
|||
// need to make sure we have it in our nodeList.
|
||||
OctreeQueryNode* nodeData = dynamic_cast<OctreeQueryNode*>(senderNode->getLinkedData());
|
||||
if (nodeData) {
|
||||
nodeData->parseNackPacket(packet->getData());
|
||||
nodeData->parseNackPacket(*packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,9 @@ void IceServer::processDatagrams() {
|
|||
SharedNetworkPeer matchingPeer = _activePeers.value(connectRequestID);
|
||||
|
||||
if (matchingPeer) {
|
||||
|
||||
qDebug() << "Sending information for peer" << connectRequestID << "to peer" << senderUUID;
|
||||
|
||||
// we have the peer they want to connect to - send them pack the information for that peer
|
||||
sendPeerInformationPacket(*(matchingPeer.data()), &sendingSockAddr);
|
||||
|
||||
|
@ -90,6 +93,8 @@ void IceServer::processDatagrams() {
|
|||
|
||||
NetworkPeer dummyPeer(senderUUID, publicSocket, localSocket);
|
||||
sendPeerInformationPacket(dummyPeer, matchingPeer->getActiveSocket());
|
||||
} else {
|
||||
qDebug() << "Peer" << senderUUID << "asked for" << connectRequestID << "but no matching peer found";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue