repairs to nack packet receiving for entity-server

This commit is contained in:
Stephen Birarda 2015-07-16 15:29:50 -07:00
parent b1d240defd
commit 29f91267d9
4 changed files with 10 additions and 18 deletions

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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();

View file

@ -831,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);
}
}