mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:29:32 +02:00
moved _sequenceNumber back to OctreeQueryNode
instead added incrementSequenceNumber() to OctreeQueryNode for sendthread to use
This commit is contained in:
parent
a6d0384c3b
commit
87d927d447
4 changed files with 16 additions and 17 deletions
|
@ -38,7 +38,7 @@ OctreeQueryNode::OctreeQueryNode() :
|
||||||
_lastClientOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
_lastClientOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
||||||
_lodChanged(false),
|
_lodChanged(false),
|
||||||
_lodInitialized(false),
|
_lodInitialized(false),
|
||||||
//_sequenceNumber(0),
|
_sequenceNumber(0),
|
||||||
_lastRootTimestamp(0),
|
_lastRootTimestamp(0),
|
||||||
_myPacketType(PacketTypeUnknown),
|
_myPacketType(PacketTypeUnknown),
|
||||||
_isShuttingDown(false)
|
_isShuttingDown(false)
|
||||||
|
@ -158,11 +158,11 @@ bool OctreeQueryNode::shouldSuppressDuplicatePacket() {
|
||||||
|
|
||||||
void OctreeQueryNode::init() {
|
void OctreeQueryNode::init() {
|
||||||
_myPacketType = getMyPacketType();
|
_myPacketType = getMyPacketType();
|
||||||
resetOctreePacket(true); // don't bump sequence
|
resetOctreePacket(); // don't bump sequence
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OctreeQueryNode::resetOctreePacket(OCTREE_PACKET_SEQUENCE sequenceNumber) {
|
void OctreeQueryNode::resetOctreePacket() {
|
||||||
// if shutting down, return immediately
|
// if shutting down, return immediately
|
||||||
if (_isShuttingDown) {
|
if (_isShuttingDown) {
|
||||||
return;
|
return;
|
||||||
|
@ -201,12 +201,11 @@ void OctreeQueryNode::resetOctreePacket(OCTREE_PACKET_SEQUENCE sequenceNumber) {
|
||||||
|
|
||||||
// pack in sequence number
|
// pack in sequence number
|
||||||
OCTREE_PACKET_SEQUENCE* sequenceAt = (OCTREE_PACKET_SEQUENCE*)_octreePacketAt;
|
OCTREE_PACKET_SEQUENCE* sequenceAt = (OCTREE_PACKET_SEQUENCE*)_octreePacketAt;
|
||||||
*sequenceAt = sequenceNumber;
|
*sequenceAt = _sequenceNumber;
|
||||||
_octreePacketAt += sizeof(OCTREE_PACKET_SEQUENCE);
|
_octreePacketAt += sizeof(OCTREE_PACKET_SEQUENCE);
|
||||||
_octreePacketAvailableBytes -= sizeof(OCTREE_PACKET_SEQUENCE);
|
_octreePacketAvailableBytes -= sizeof(OCTREE_PACKET_SEQUENCE);
|
||||||
/*
|
/*
|
||||||
if (!(lastWasSurpressed || _lastOctreePacketLength == (numBytesPacketHeader + OCTREE_PACKET_EXTRA_HEADERS_SIZE))) {
|
if (!(lastWasSurpressed || _lastOctreePacketLength == (numBytesPacketHeader + OCTREE_PACKET_EXTRA_HEADERS_SIZE))) {
|
||||||
qDebug() << "_sequenceNumber is now " << _sequenceNumber << " ***********************************************";
|
|
||||||
_sequenceNumber++;
|
_sequenceNumber++;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
@ -370,3 +369,6 @@ void OctreeQueryNode::dumpOutOfView() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OctreeQueryNode::incrementSequenceNumber() {
|
||||||
|
_sequenceNumber++;
|
||||||
|
}
|
|
@ -35,7 +35,7 @@ public:
|
||||||
void init(); // called after creation to set up some virtual items
|
void init(); // called after creation to set up some virtual items
|
||||||
virtual PacketType getMyPacketType() const = 0;
|
virtual PacketType getMyPacketType() const = 0;
|
||||||
|
|
||||||
void resetOctreePacket(OCTREE_PACKET_SEQUENCE sequenceNumber); // resets octree packet to after "V" header
|
void resetOctreePacket(); // resets octree packet to after "V" header
|
||||||
|
|
||||||
void writeToPacket(const unsigned char* buffer, unsigned int bytes); // writes to end of packet
|
void writeToPacket(const unsigned char* buffer, unsigned int bytes); // writes to end of packet
|
||||||
|
|
||||||
|
@ -100,6 +100,8 @@ public:
|
||||||
void forceNodeShutdown();
|
void forceNodeShutdown();
|
||||||
bool isShuttingDown() const { return _isShuttingDown; }
|
bool isShuttingDown() const { return _isShuttingDown; }
|
||||||
|
|
||||||
|
void incrementSequenceNumber();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void sendThreadFinished();
|
void sendThreadFinished();
|
||||||
|
|
||||||
|
@ -136,7 +138,7 @@ private:
|
||||||
bool _lodChanged;
|
bool _lodChanged;
|
||||||
bool _lodInitialized;
|
bool _lodInitialized;
|
||||||
|
|
||||||
//OCTREE_PACKET_SEQUENCE _sequenceNumber;
|
OCTREE_PACKET_SEQUENCE _sequenceNumber;
|
||||||
|
|
||||||
quint64 _lastRootTimestamp;
|
quint64 _lastRootTimestamp;
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,7 @@ OctreeSendThread::OctreeSendThread(const SharedAssignmentPointer& myAssignment,
|
||||||
_nodeUUID(node->getUUID()),
|
_nodeUUID(node->getUUID()),
|
||||||
_packetData(),
|
_packetData(),
|
||||||
_nodeMissingCount(0),
|
_nodeMissingCount(0),
|
||||||
_isShuttingDown(false),
|
_isShuttingDown(false)
|
||||||
_sequenceNumber(0)
|
|
||||||
{
|
{
|
||||||
QString safeServerName("Octree");
|
QString safeServerName("Octree");
|
||||||
if (_myServer) {
|
if (_myServer) {
|
||||||
|
@ -138,7 +137,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
// obscure the packet and not send it. This allows the callers and upper level logic to not need to know about
|
// obscure the packet and not send it. This allows the callers and upper level logic to not need to know about
|
||||||
// this rate control savings.
|
// this rate control savings.
|
||||||
if (nodeData->shouldSuppressDuplicatePacket()) {
|
if (nodeData->shouldSuppressDuplicatePacket()) {
|
||||||
nodeData->resetOctreePacket(_sequenceNumber); // we still need to reset it though!
|
nodeData->resetOctreePacket(); // we still need to reset it though!
|
||||||
return packetsSent; // without sending...
|
return packetsSent; // without sending...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,10 +242,8 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
trueBytesSent += nodeData->getPacketLength();
|
trueBytesSent += nodeData->getPacketLength();
|
||||||
truePacketsSent++;
|
truePacketsSent++;
|
||||||
packetsSent++;
|
packetsSent++;
|
||||||
|
nodeData->incrementSequenceNumber();
|
||||||
_sequenceNumber++;
|
nodeData->resetOctreePacket();
|
||||||
|
|
||||||
nodeData->resetOctreePacket(_sequenceNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return packetsSent;
|
return packetsSent;
|
||||||
|
@ -286,7 +283,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
if (nodeData->isPacketWaiting()) {
|
if (nodeData->isPacketWaiting()) {
|
||||||
packetsSentThisInterval += handlePacketSend(nodeData, trueBytesSent, truePacketsSent);
|
packetsSentThisInterval += handlePacketSend(nodeData, trueBytesSent, truePacketsSent);
|
||||||
} else {
|
} else {
|
||||||
nodeData->resetOctreePacket(_sequenceNumber);
|
nodeData->resetOctreePacket();
|
||||||
}
|
}
|
||||||
int targetSize = MAX_OCTREE_PACKET_DATA_SIZE;
|
int targetSize = MAX_OCTREE_PACKET_DATA_SIZE;
|
||||||
if (wantCompression) {
|
if (wantCompression) {
|
||||||
|
|
|
@ -55,8 +55,6 @@ private:
|
||||||
|
|
||||||
int _nodeMissingCount;
|
int _nodeMissingCount;
|
||||||
bool _isShuttingDown;
|
bool _isShuttingDown;
|
||||||
|
|
||||||
OCTREE_PACKET_SEQUENCE _sequenceNumber;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_OctreeSendThread_h
|
#endif // hifi_OctreeSendThread_h
|
||||||
|
|
Loading…
Reference in a new issue