mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:23:33 +02:00
Merge pull request #2910 from wangyix/master
fix for skipped sequenceNumber bug in OctreeQueryNode
This commit is contained in:
commit
fe79fa3de2
4 changed files with 15 additions and 12 deletions
|
@ -158,10 +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(bool lastWasSurpressed) {
|
|
||||||
|
void OctreeQueryNode::resetOctreePacket() {
|
||||||
// if shutting down, return immediately
|
// if shutting down, return immediately
|
||||||
if (_isShuttingDown) {
|
if (_isShuttingDown) {
|
||||||
return;
|
return;
|
||||||
|
@ -196,15 +197,12 @@ void OctreeQueryNode::resetOctreePacket(bool lastWasSurpressed) {
|
||||||
*flagsAt = flags;
|
*flagsAt = flags;
|
||||||
_octreePacketAt += sizeof(OCTREE_PACKET_FLAGS);
|
_octreePacketAt += sizeof(OCTREE_PACKET_FLAGS);
|
||||||
_octreePacketAvailableBytes -= sizeof(OCTREE_PACKET_FLAGS);
|
_octreePacketAvailableBytes -= sizeof(OCTREE_PACKET_FLAGS);
|
||||||
|
|
||||||
// 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))) {
|
|
||||||
_sequenceNumber++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// pack in timestamp
|
// pack in timestamp
|
||||||
OCTREE_PACKET_SENT_TIME now = usecTimestampNow();
|
OCTREE_PACKET_SENT_TIME now = usecTimestampNow();
|
||||||
|
@ -365,3 +363,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(bool lastWasSurpressed = false); // 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
|
||||||
|
|
||||||
|
@ -99,6 +99,8 @@ public:
|
||||||
void nodeKilled();
|
void nodeKilled();
|
||||||
void forceNodeShutdown();
|
void forceNodeShutdown();
|
||||||
bool isShuttingDown() const { return _isShuttingDown; }
|
bool isShuttingDown() const { return _isShuttingDown; }
|
||||||
|
|
||||||
|
void incrementSequenceNumber();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void sendThreadFinished();
|
void sendThreadFinished();
|
||||||
|
@ -135,8 +137,9 @@ private:
|
||||||
float _lastClientOctreeSizeScale;
|
float _lastClientOctreeSizeScale;
|
||||||
bool _lodChanged;
|
bool _lodChanged;
|
||||||
bool _lodInitialized;
|
bool _lodInitialized;
|
||||||
|
|
||||||
OCTREE_PACKET_SEQUENCE _sequenceNumber;
|
OCTREE_PACKET_SEQUENCE _sequenceNumber;
|
||||||
|
|
||||||
quint64 _lastRootTimestamp;
|
quint64 _lastRootTimestamp;
|
||||||
|
|
||||||
PacketType _myPacketType;
|
PacketType _myPacketType;
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <QMutexLocker>
|
|
||||||
|
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
@ -139,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(true); // we still need to reset it though!
|
nodeData->resetOctreePacket(); // we still need to reset it though!
|
||||||
return packetsSent; // without sending...
|
return packetsSent; // without sending...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +242,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
trueBytesSent += nodeData->getPacketLength();
|
trueBytesSent += nodeData->getPacketLength();
|
||||||
truePacketsSent++;
|
truePacketsSent++;
|
||||||
packetsSent++;
|
packetsSent++;
|
||||||
|
nodeData->incrementSequenceNumber();
|
||||||
nodeData->resetOctreePacket();
|
nodeData->resetOctreePacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var alwaysLook = true; // if you want the mouse look to happen only when you click, change this to false
|
var alwaysLook = false; // if you want the mouse look to happen only when you click, change this to false
|
||||||
var isMouseDown = false;
|
var isMouseDown = false;
|
||||||
var lastX = 0;
|
var lastX = 0;
|
||||||
var lastY = 0;
|
var lastY = 0;
|
||||||
|
|
Loading…
Reference in a new issue