mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 23:49:55 +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
|
@ -260,7 +260,7 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
||||||
// if there are packets from _node that are waiting to be processed,
|
// 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.
|
// don't send a NACK since the missing packets may be among those waiting packets.
|
||||||
if (hasPacketsToProcessFrom(nodeUUID)) {
|
if (hasPacketsToProcessFrom(nodeUUID)) {
|
||||||
i++;
|
++i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +290,8 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
||||||
// send the list of nack packets
|
// send the list of nack packets
|
||||||
nodeList->sendPacketList(nackPacketList, *destinationNode);
|
nodeList->sendPacketList(nackPacketList, *destinationNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return packetsSent;
|
return packetsSent;
|
||||||
|
|
|
@ -374,21 +374,11 @@ const NLPacket* OctreeQueryNode::getNextNackedPacket() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreeQueryNode::parseNackPacket(const QByteArray& packet) {
|
void OctreeQueryNode::parseNackPacket(NLPacket& 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);
|
|
||||||
|
|
||||||
// read sequence numbers
|
// read sequence numbers
|
||||||
for (int i = 0; i < numSequenceNumbers; i++) {
|
while (packet.bytesLeftToRead()) {
|
||||||
OCTREE_PACKET_SEQUENCE sequenceNumber = (*(OCTREE_PACKET_SEQUENCE*)dataAt);
|
OCTREE_PACKET_SEQUENCE sequenceNumber;
|
||||||
|
packet.readPrimitive(&sequenceNumber);
|
||||||
_nackedSequenceNumbers.enqueue(sequenceNumber);
|
_nackedSequenceNumbers.enqueue(sequenceNumber);
|
||||||
dataAt += sizeof(OCTREE_PACKET_SEQUENCE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public:
|
||||||
|
|
||||||
OCTREE_PACKET_SEQUENCE getSequenceNumber() const { return _sequenceNumber; }
|
OCTREE_PACKET_SEQUENCE getSequenceNumber() const { return _sequenceNumber; }
|
||||||
|
|
||||||
void parseNackPacket(const QByteArray& packet);
|
void parseNackPacket(NLPacket& packet);
|
||||||
bool hasNextNackedPacket() const;
|
bool hasNextNackedPacket() const;
|
||||||
const NLPacket* getNextNackedPacket();
|
const NLPacket* getNextNackedPacket();
|
||||||
|
|
||||||
|
|
|
@ -813,6 +813,7 @@ void OctreeServer::parsePayload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreeServer::handleOctreeQueryPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode) {
|
void OctreeServer::handleOctreeQueryPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode) {
|
||||||
|
if (!_isFinished) {
|
||||||
// If we got a query packet, then we're talking to an agent, and we
|
// 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.
|
// need to make sure we have it in our nodeList.
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
@ -823,13 +824,14 @@ void OctreeServer::handleOctreeQueryPacket(QSharedPointer<NLPacket> packet, Shar
|
||||||
nodeData->initializeOctreeSendThread(this, senderNode);
|
nodeData->initializeOctreeSendThread(this, senderNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OctreeServer::handleOctreeDataNackPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode) {
|
void OctreeServer::handleOctreeDataNackPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode) {
|
||||||
// If we got a nack packet, then we're talking to an agent, and we
|
// If we got a nack packet, then we're talking to an agent, and we
|
||||||
// need to make sure we have it in our nodeList.
|
// need to make sure we have it in our nodeList.
|
||||||
OctreeQueryNode* nodeData = dynamic_cast<OctreeQueryNode*>(senderNode->getLinkedData());
|
OctreeQueryNode* nodeData = dynamic_cast<OctreeQueryNode*>(senderNode->getLinkedData());
|
||||||
if (nodeData) {
|
if (nodeData) {
|
||||||
nodeData->parseNackPacket(packet->getData());
|
nodeData->parseNackPacket(*packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,9 @@ void IceServer::processDatagrams() {
|
||||||
SharedNetworkPeer matchingPeer = _activePeers.value(connectRequestID);
|
SharedNetworkPeer matchingPeer = _activePeers.value(connectRequestID);
|
||||||
|
|
||||||
if (matchingPeer) {
|
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
|
// we have the peer they want to connect to - send them pack the information for that peer
|
||||||
sendPeerInformationPacket(*(matchingPeer.data()), &sendingSockAddr);
|
sendPeerInformationPacket(*(matchingPeer.data()), &sendingSockAddr);
|
||||||
|
|
||||||
|
@ -90,6 +93,8 @@ void IceServer::processDatagrams() {
|
||||||
|
|
||||||
NetworkPeer dummyPeer(senderUUID, publicSocket, localSocket);
|
NetworkPeer dummyPeer(senderUUID, publicSocket, localSocket);
|
||||||
sendPeerInformationPacket(dummyPeer, matchingPeer->getActiveSocket());
|
sendPeerInformationPacket(dummyPeer, matchingPeer->getActiveSocket());
|
||||||
|
} else {
|
||||||
|
qDebug() << "Peer" << senderUUID << "asked for" << connectRequestID << "but no matching peer found";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue