move sending of packet to immediately following scene end to get better synch of stats packets, also fix duplicate suppression bug

This commit is contained in:
ZappoMan 2013-11-22 17:00:39 -08:00
parent e60c482086
commit 80cfba465c
2 changed files with 4 additions and 6 deletions

View file

@ -73,12 +73,12 @@ bool VoxelNodeData::shouldSuppressDuplicatePacket() {
// How long has it been since we've sent one, if we're still under our max time, then keep considering
// this packet for suppression
uint64_t now = usecTimestampNow();
long sinceFirstSuppressedPacket = now - _firstSuppressedPacket;
int sinceFirstSuppressedPacket = now - _firstSuppressedPacket;
const long MAX_TIME_BETWEEN_DUPLICATE_PACKETS = 1000 * 1000; // 1 second.
if (sinceFirstSuppressedPacket < MAX_TIME_BETWEEN_DUPLICATE_PACKETS) {
// Finally, if we know we've sent at least one duplicate out, then suppress the rest...
if (_duplicatePacketCount > 1) {
if (_duplicatePacketCount >= 1) {
shouldSuppress = true;
}
} else {

View file

@ -290,8 +290,8 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
uint64_t now = usecTimestampNow();
nodeData->setLastTimeBagEmpty(now);
}
nodeData->stats.sceneCompleted();
packetsSentThisInterval += handlePacketSend(node, nodeData, trueBytesSent, truePacketsSent);
if (_myServer->wantDisplayVoxelStats()) {
nodeData->stats.printDebugDetails();
@ -305,6 +305,7 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
if (isFullScene) {
nodeData->nodeBag.deleteAll();
}
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged, _myServer->getServerTree().rootNode, _myServer->getJurisdiction());
// This is the start of "resending" the scene.
@ -430,9 +431,6 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
_tempPacket.reset();
}
}
if (nodeData->isPacketWaiting()) {
packetsSentThisInterval += handlePacketSend(node, nodeData, trueBytesSent, truePacketsSent);
}
// send the environment packet
if (shouldSendEnvironments) {