mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 15:59:49 +02:00
Merge branch 'protocol' of github.com:Atlante45/hifi into protocol
This commit is contained in:
commit
c4526aa783
7 changed files with 27 additions and 28 deletions
|
@ -219,7 +219,7 @@ void AvatarMixer::broadcastAvatarData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup a PacketList for the avatarPackets
|
// setup a PacketList for the avatarPackets
|
||||||
NLPacketList avatarPacketList(PacketType::AvatarData);
|
NLPacketList avatarPacketList(PacketType::BulkAvatarData);
|
||||||
|
|
||||||
// this is an AGENT we have received head data from
|
// this is an AGENT we have received head data from
|
||||||
// send back a packet with other active node data to this node
|
// send back a packet with other active node data to this node
|
||||||
|
|
|
@ -250,7 +250,7 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
||||||
|
|
||||||
QUuid nodeUUID = i.key();
|
QUuid nodeUUID = i.key();
|
||||||
SingleSenderStats nodeStats = i.value();
|
SingleSenderStats nodeStats = i.value();
|
||||||
|
|
||||||
// check if this node is still alive. Remove its stats if it's dead.
|
// check if this node is still alive. Remove its stats if it's dead.
|
||||||
if (!isAlive(nodeUUID)) {
|
if (!isAlive(nodeUUID)) {
|
||||||
i = _singleSenderStats.erase(i);
|
i = _singleSenderStats.erase(i);
|
||||||
|
@ -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,14 +813,16 @@ void OctreeServer::parsePayload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreeServer::handleOctreeQueryPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode) {
|
void OctreeServer::handleOctreeQueryPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode) {
|
||||||
// If we got a query packet, then we're talking to an agent, and we
|
if (!_isFinished) {
|
||||||
// need to make sure we have it in our nodeList.
|
// If we got a query packet, then we're talking to an agent, and we
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
// need to make sure we have it in our nodeList.
|
||||||
nodeList->updateNodeWithDataFromPacket(packet, senderNode);
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
nodeList->updateNodeWithDataFromPacket(packet, senderNode);
|
||||||
OctreeQueryNode* nodeData = dynamic_cast<OctreeQueryNode*>(senderNode->getLinkedData());
|
|
||||||
if (nodeData && !nodeData->isOctreeSendThreadInitalized()) {
|
OctreeQueryNode* nodeData = dynamic_cast<OctreeQueryNode*>(senderNode->getLinkedData());
|
||||||
nodeData->initializeOctreeSendThread(this, senderNode);
|
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.
|
// 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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ AvatarHashMap::AvatarHashMap() {
|
||||||
connect(DependencyManager::get<NodeList>().data(), &NodeList::uuidChanged, this, &AvatarHashMap::sessionUUIDChanged);
|
connect(DependencyManager::get<NodeList>().data(), &NodeList::uuidChanged, this, &AvatarHashMap::sessionUUIDChanged);
|
||||||
|
|
||||||
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
|
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
|
||||||
packetReceiver.registerListener(PacketType::AvatarData, this, "processAvatarDataPacket");
|
packetReceiver.registerListener(PacketType::BulkAvatarData, this, "processAvatarDataPacket");
|
||||||
packetReceiver.registerListener(PacketType::KillAvatar, this, "processKillAvatar");
|
packetReceiver.registerListener(PacketType::KillAvatar, this, "processKillAvatar");
|
||||||
packetReceiver.registerListener(PacketType::AvatarIdentity, this, "processAvatarIdentityPacket");
|
packetReceiver.registerListener(PacketType::AvatarIdentity, this, "processAvatarIdentityPacket");
|
||||||
packetReceiver.registerListener(PacketType::AvatarBillboard, this, "processAvatarBillboardPacket");
|
packetReceiver.registerListener(PacketType::AvatarBillboard, this, "processAvatarBillboardPacket");
|
||||||
|
|
Loading…
Reference in a new issue