mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:21:16 +02:00
remove some logging
This commit is contained in:
parent
040bae6014
commit
bdfe304f7a
2 changed files with 32 additions and 23 deletions
|
@ -84,10 +84,13 @@ bool EntityServer::hasSpecialPacketsToSend(const SharedNodePointer& node) {
|
||||||
quint64 deletedEntitiesSentAt = nodeData->getLastDeletedEntitiesSentAt();
|
quint64 deletedEntitiesSentAt = nodeData->getLastDeletedEntitiesSentAt();
|
||||||
EntityTreePointer tree = std::static_pointer_cast<EntityTree>(_tree);
|
EntityTreePointer tree = std::static_pointer_cast<EntityTree>(_tree);
|
||||||
shouldSendDeletedEntities = tree->hasEntitiesDeletedSince(deletedEntitiesSentAt);
|
shouldSendDeletedEntities = tree->hasEntitiesDeletedSince(deletedEntitiesSentAt);
|
||||||
if (shouldSendDeletedEntities) {
|
|
||||||
int elapsed = usecTimestampNow() - deletedEntitiesSentAt;
|
#ifdef EXTRA_ERASE_DEBUGGING
|
||||||
qDebug() << "shouldSendDeletedEntities to node:" << node->getUUID() << "deletedEntitiesSentAt:" << deletedEntitiesSentAt << "elapsed:" << elapsed;
|
if (shouldSendDeletedEntities) {
|
||||||
}
|
int elapsed = usecTimestampNow() - deletedEntitiesSentAt;
|
||||||
|
qDebug() << "shouldSendDeletedEntities to node:" << node->getUUID() << "deletedEntitiesSentAt:" << deletedEntitiesSentAt << "elapsed:" << elapsed;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return shouldSendDeletedEntities;
|
return shouldSendDeletedEntities;
|
||||||
|
@ -120,9 +123,12 @@ int EntityServer::sendSpecialPackets(const SharedNodePointer& node, OctreeQueryN
|
||||||
nodeData->setLastDeletedEntitiesSentAt(deletePacketSentAt);
|
nodeData->setLastDeletedEntitiesSentAt(deletePacketSentAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetsSent > 0) {
|
#ifdef EXTRA_ERASE_DEBUGGING
|
||||||
qDebug() << "EntityServer::sendSpecialPackets() sent " << packetsSent << "special packets of " << totalBytes << " total bytes to node:" << node->getUUID();
|
if (packetsSent > 0) {
|
||||||
}
|
qDebug() << "EntityServer::sendSpecialPackets() sent " << packetsSent << "special packets of "
|
||||||
|
<< totalBytes << " total bytes to node:" << node->getUUID();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: caller is expecting a packetLength, what if we send more than one packet??
|
// TODO: caller is expecting a packetLength, what if we send more than one packet??
|
||||||
return totalBytes;
|
return totalBytes;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "RecurseOctreeToMapOperator.h"
|
#include "RecurseOctreeToMapOperator.h"
|
||||||
#include "LogHandler.h"
|
#include "LogHandler.h"
|
||||||
|
|
||||||
const quint64 EntityTree::DELETED_ENTITIES_EXTRA_USECS_TO_CONSIDER = USECS_PER_MSEC * 500;
|
const quint64 EntityTree::DELETED_ENTITIES_EXTRA_USECS_TO_CONSIDER = USECS_PER_MSEC * 50;
|
||||||
|
|
||||||
EntityTree::EntityTree(bool shouldReaverage) :
|
EntityTree::EntityTree(bool shouldReaverage) :
|
||||||
Octree(shouldReaverage),
|
Octree(shouldReaverage),
|
||||||
|
@ -819,12 +819,14 @@ bool EntityTree::hasEntitiesDeletedSince(quint64 sinceTime) {
|
||||||
++iterator;
|
++iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EXTRA_ERASE_DEBUGGING
|
||||||
if (hasSomethingNewer) {
|
if (hasSomethingNewer) {
|
||||||
int elapsed = usecTimestampNow() - considerEntitiesSince;
|
int elapsed = usecTimestampNow() - considerEntitiesSince;
|
||||||
int difference = considerEntitiesSince - sinceTime;
|
int difference = considerEntitiesSince - sinceTime;
|
||||||
qDebug() << "EntityTree::hasEntitiesDeletedSince() sinceTime:" << sinceTime
|
qDebug() << "EntityTree::hasEntitiesDeletedSince() sinceTime:" << sinceTime
|
||||||
<< "considerEntitiesSince:" << considerEntitiesSince << "elapsed:" << elapsed << "difference:" << difference;
|
<< "considerEntitiesSince:" << considerEntitiesSince << "elapsed:" << elapsed << "difference:" << difference;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return hasSomethingNewer;
|
return hasSomethingNewer;
|
||||||
}
|
}
|
||||||
|
@ -832,16 +834,12 @@ bool EntityTree::hasEntitiesDeletedSince(quint64 sinceTime) {
|
||||||
// sinceTime is an in/out parameter - it will be side effected with the last time sent out
|
// sinceTime is an in/out parameter - it will be side effected with the last time sent out
|
||||||
std::unique_ptr<NLPacket> EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_SEQUENCE sequenceNumber, quint64& sinceTime,
|
std::unique_ptr<NLPacket> EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_SEQUENCE sequenceNumber, quint64& sinceTime,
|
||||||
bool& hasMore) {
|
bool& hasMore) {
|
||||||
qDebug() << "EntityTree::encodeEntitiesDeletedSince()";
|
|
||||||
|
|
||||||
quint64 considerEntitiesSince = sinceTime - DELETED_ENTITIES_EXTRA_USECS_TO_CONSIDER;
|
quint64 considerEntitiesSince = sinceTime - DELETED_ENTITIES_EXTRA_USECS_TO_CONSIDER;
|
||||||
auto deletesPacket = NLPacket::create(PacketType::EntityErase);
|
auto deletesPacket = NLPacket::create(PacketType::EntityErase);
|
||||||
qDebug() << " ---- at line:" << __LINE__ << " deletes packet size:" << deletesPacket->getDataSize();
|
|
||||||
|
|
||||||
// pack in flags
|
// pack in flags
|
||||||
OCTREE_PACKET_FLAGS flags = 0;
|
OCTREE_PACKET_FLAGS flags = 0;
|
||||||
deletesPacket->writePrimitive(flags);
|
deletesPacket->writePrimitive(flags);
|
||||||
qDebug() << " ---- at line:" << __LINE__ << " deletes packet size:" << deletesPacket->getDataSize();
|
|
||||||
|
|
||||||
// pack in sequence number
|
// pack in sequence number
|
||||||
deletesPacket->writePrimitive(sequenceNumber);
|
deletesPacket->writePrimitive(sequenceNumber);
|
||||||
|
@ -849,13 +847,11 @@ std::unique_ptr<NLPacket> EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_S
|
||||||
// pack in timestamp
|
// pack in timestamp
|
||||||
OCTREE_PACKET_SENT_TIME now = usecTimestampNow();
|
OCTREE_PACKET_SENT_TIME now = usecTimestampNow();
|
||||||
deletesPacket->writePrimitive(now);
|
deletesPacket->writePrimitive(now);
|
||||||
qDebug() << " ---- at line:" << __LINE__ << " deletes packet size:" << deletesPacket->getDataSize();
|
|
||||||
|
|
||||||
// figure out where we are now and pack a temporary number of IDs
|
// figure out where we are now and pack a temporary number of IDs
|
||||||
uint16_t numberOfIDs = 0;
|
uint16_t numberOfIDs = 0;
|
||||||
qint64 numberOfIDsPos = deletesPacket->pos();
|
qint64 numberOfIDsPos = deletesPacket->pos();
|
||||||
deletesPacket->writePrimitive(numberOfIDs);
|
deletesPacket->writePrimitive(numberOfIDs);
|
||||||
qDebug() << " ---- at line:" << __LINE__ << " deletes packet size:" << deletesPacket->getDataSize();
|
|
||||||
|
|
||||||
// we keep a multi map of entity IDs to timestamps, we only want to include the entity IDs that have been
|
// we keep a multi map of entity IDs to timestamps, we only want to include the entity IDs that have been
|
||||||
// deleted since we last sent to this node
|
// deleted since we last sent to this node
|
||||||
|
@ -879,10 +875,12 @@ std::unique_ptr<NLPacket> EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_S
|
||||||
// history for a longer time window, these entities are not "lost". But we haven't yet
|
// history for a longer time window, these entities are not "lost". But we haven't yet
|
||||||
// found/fixed the underlying issue that caused bad UUIDs to be sent to some users.
|
// found/fixed the underlying issue that caused bad UUIDs to be sent to some users.
|
||||||
deletesPacket->write(entityID.toRfc4122());
|
deletesPacket->write(entityID.toRfc4122());
|
||||||
qDebug() << "EntityTree::encodeEntitiesDeletedSince() including:" << entityID;
|
|
||||||
qDebug() << " ---- at line:" << __LINE__ << " deletes packet size:" << deletesPacket->getDataSize();
|
|
||||||
++numberOfIDs;
|
++numberOfIDs;
|
||||||
|
|
||||||
|
#ifdef EXTRA_ERASE_DEBUGGING
|
||||||
|
qDebug() << "EntityTree::encodeEntitiesDeletedSince() including:" << entityID;
|
||||||
|
#endif
|
||||||
|
|
||||||
// check to make sure we have room for one more ID
|
// check to make sure we have room for one more ID
|
||||||
if (NUM_BYTES_RFC4122_UUID > deletesPacket->bytesAvailableForWrite()) {
|
if (NUM_BYTES_RFC4122_UUID > deletesPacket->bytesAvailableForWrite()) {
|
||||||
hasFilledPacket = true;
|
hasFilledPacket = true;
|
||||||
|
@ -910,9 +908,6 @@ std::unique_ptr<NLPacket> EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_S
|
||||||
// replace the count for the number of included IDs
|
// replace the count for the number of included IDs
|
||||||
deletesPacket->seek(numberOfIDsPos);
|
deletesPacket->seek(numberOfIDsPos);
|
||||||
deletesPacket->writePrimitive(numberOfIDs);
|
deletesPacket->writePrimitive(numberOfIDs);
|
||||||
qDebug() << " ---- at line:" << __LINE__ <<" deletes packet size:" << deletesPacket->getDataSize();
|
|
||||||
|
|
||||||
qDebug() << " ---- EntityTree::encodeEntitiesDeletedSince() numberOfIDs:" << numberOfIDs;
|
|
||||||
|
|
||||||
return deletesPacket;
|
return deletesPacket;
|
||||||
}
|
}
|
||||||
|
@ -942,7 +937,9 @@ void EntityTree::forgetEntitiesDeletedBefore(quint64 sinceTime) {
|
||||||
|
|
||||||
// TODO: consider consolidating processEraseMessageDetails() and processEraseMessage()
|
// TODO: consider consolidating processEraseMessageDetails() and processEraseMessage()
|
||||||
int EntityTree::processEraseMessage(NLPacket& packet, const SharedNodePointer& sourceNode) {
|
int EntityTree::processEraseMessage(NLPacket& packet, const SharedNodePointer& sourceNode) {
|
||||||
qDebug() << "EntityTree::processEraseMessage()";
|
#ifdef EXTRA_ERASE_DEBUGGING
|
||||||
|
qDebug() << "EntityTree::processEraseMessage()";
|
||||||
|
#endif
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
packet.seek(sizeof(OCTREE_PACKET_FLAGS) + sizeof(OCTREE_PACKET_SEQUENCE) + sizeof(OCTREE_PACKET_SENT_TIME));
|
packet.seek(sizeof(OCTREE_PACKET_FLAGS) + sizeof(OCTREE_PACKET_SEQUENCE) + sizeof(OCTREE_PACKET_SENT_TIME));
|
||||||
|
|
||||||
|
@ -960,7 +957,9 @@ int EntityTree::processEraseMessage(NLPacket& packet, const SharedNodePointer& s
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid entityID = QUuid::fromRfc4122(packet.readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
QUuid entityID = QUuid::fromRfc4122(packet.readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||||
qDebug() << " ---- EntityTree::processEraseMessage() contained ID:" << entityID;
|
#ifdef EXTRA_ERASE_DEBUGGING
|
||||||
|
qDebug() << " ---- EntityTree::processEraseMessage() contained ID:" << entityID;
|
||||||
|
#endif
|
||||||
|
|
||||||
EntityItemID entityItemID(entityID);
|
EntityItemID entityItemID(entityID);
|
||||||
entityItemIDsToDelete << entityItemID;
|
entityItemIDsToDelete << entityItemID;
|
||||||
|
@ -980,7 +979,9 @@ int EntityTree::processEraseMessage(NLPacket& packet, const SharedNodePointer& s
|
||||||
// NOTE: Caller must lock the tree before calling this.
|
// NOTE: Caller must lock the tree before calling this.
|
||||||
// TODO: consider consolidating processEraseMessageDetails() and processEraseMessage()
|
// TODO: consider consolidating processEraseMessageDetails() and processEraseMessage()
|
||||||
int EntityTree::processEraseMessageDetails(const QByteArray& dataByteArray, const SharedNodePointer& sourceNode) {
|
int EntityTree::processEraseMessageDetails(const QByteArray& dataByteArray, const SharedNodePointer& sourceNode) {
|
||||||
qDebug() << "EntityTree::processEraseMessageDetails()";
|
#ifdef EXTRA_ERASE_DEBUGGING
|
||||||
|
qDebug() << "EntityTree::processEraseMessageDetails()";
|
||||||
|
#endif
|
||||||
const unsigned char* packetData = (const unsigned char*)dataByteArray.constData();
|
const unsigned char* packetData = (const unsigned char*)dataByteArray.constData();
|
||||||
const unsigned char* dataAt = packetData;
|
const unsigned char* dataAt = packetData;
|
||||||
size_t packetLength = dataByteArray.size();
|
size_t packetLength = dataByteArray.size();
|
||||||
|
@ -1007,7 +1008,9 @@ int EntityTree::processEraseMessageDetails(const QByteArray& dataByteArray, cons
|
||||||
dataAt += encodedID.size();
|
dataAt += encodedID.size();
|
||||||
processedBytes += encodedID.size();
|
processedBytes += encodedID.size();
|
||||||
|
|
||||||
qDebug() << " ---- EntityTree::processEraseMessageDetails() contains id:" << entityID;
|
#ifdef EXTRA_ERASE_DEBUGGING
|
||||||
|
qDebug() << " ---- EntityTree::processEraseMessageDetails() contains id:" << entityID;
|
||||||
|
#endif
|
||||||
|
|
||||||
EntityItemID entityItemID(entityID);
|
EntityItemID entityItemID(entityID);
|
||||||
entityItemIDsToDelete << entityItemID;
|
entityItemIDsToDelete << entityItemID;
|
||||||
|
|
Loading…
Reference in a new issue