mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:10:40 +02:00
removed debug info, cleaned code for pull req
This commit is contained in:
parent
a0f9d2c106
commit
c87c474877
10 changed files with 67 additions and 117 deletions
|
@ -535,7 +535,6 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
|||
// send the environment packet
|
||||
// TODO: should we turn this into a while loop to better handle sending multiple special packets
|
||||
if (_myServer->hasSpecialPacketToSend(_node) && !nodeData->isShuttingDown()) {
|
||||
qDebug() << "sending special packet...";
|
||||
trueBytesSent += _myServer->sendSpecialPacket(_sequenceNumber, _node);
|
||||
nodeData->resetOctreePacket(_sequenceNumber); // because _sequenceNumber has changed
|
||||
truePacketsSent++;
|
||||
|
|
|
@ -3142,12 +3142,7 @@ void Application::trackIncomingVoxelPacket(const QByteArray& packet, const Share
|
|||
_octreeSceneStatsLock.lockForWrite();
|
||||
if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
|
||||
OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];
|
||||
if (stats.trackIncomingOctreePacket(packet, wasStatsPacket, sendingNode->getClockSkewUsec())) {
|
||||
|
||||
// DEBUG! unreasonable flight time
|
||||
qDebug() << " sending node type: " << NodeType::getNodeTypeName(sendingNode->getType()) << "\n";
|
||||
//qDebug() << "\t\t clock skew: " << sendingNode->getClockSkewUsec();
|
||||
}
|
||||
stats.trackIncomingOctreePacket(packet, wasStatsPacket, sendingNode->getClockSkewUsec());
|
||||
}
|
||||
_octreeSceneStatsLock.unlock();
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ void VoxelPacketProcessor::processPacket(const SharedNodePointer& sendingNode, c
|
|||
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
|
||||
//if (voxelPacketType != PacketTypeParticleErase)
|
||||
|
||||
app->trackIncomingVoxelPacket(mutablePacket, sendingNode, wasStatsPacket);
|
||||
|
||||
if (sendingNode) {
|
||||
|
|
|
@ -268,42 +268,6 @@ qint64 LimitedNodeList::writeUnverifiedDatagram(const QByteArray& datagram, cons
|
|||
|
||||
qint64 LimitedNodeList::writeDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
||||
const HifiSockAddr& overridenSockAddr) {
|
||||
/*
|
||||
QByteArray datagram(data, size);
|
||||
|
||||
qDebug() << "\t writeDatagram()...";
|
||||
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(datagram);
|
||||
const unsigned char* dataAt = reinterpret_cast<const unsigned char*>(datagram.data()) + numBytesPacketHeader;
|
||||
|
||||
PacketType type = packetTypeForPacket(datagram);
|
||||
qDebug() << "\t\t type: " << (unsigned char)type;
|
||||
|
||||
|
||||
if (type != PacketTypeOctreeStats) {
|
||||
|
||||
//qDebug() << "\t\t UUID: " << uuidFromPacketHeader(datagram);
|
||||
//qDebug() << "\t\t MD5: " << hashFromPacketHeader(datagram);
|
||||
|
||||
unsigned char flags = (*(unsigned char*)(dataAt));
|
||||
dataAt += sizeof(unsigned char);
|
||||
qDebug() << "\t\t flags: " << QString::number(flags, 2);
|
||||
|
||||
uint16_t sequence = (*(uint16_t*)dataAt);
|
||||
dataAt += sizeof(uint16_t);
|
||||
qDebug() << "\t\t sequence: " << QString::number(sequence, 16);
|
||||
|
||||
quint64 sentAt = (*(quint64*)dataAt);
|
||||
dataAt += sizeof(quint64);
|
||||
qDebug() << "\t\t sent at: " << QString::number(sentAt, 16) << "\n";
|
||||
}
|
||||
|
||||
if (type == PacketTypeParticleErase || type==PacketTypeModelErase) {
|
||||
uint16_t ids = *((uint16_t*)dataAt);
|
||||
dataAt += sizeof(uint16_t);
|
||||
qDebug() << "\t\t\t ids: " << ids;
|
||||
}
|
||||
*/
|
||||
return writeDatagram(QByteArray(data, size), destinationNode, overridenSockAddr);
|
||||
}
|
||||
|
||||
|
|
|
@ -839,7 +839,7 @@ const char* OctreeSceneStats::getItemValue(Item item) {
|
|||
return _itemValueBuffer;
|
||||
}
|
||||
|
||||
bool OctreeSceneStats::trackIncomingOctreePacket(const QByteArray& packet,
|
||||
void OctreeSceneStats::trackIncomingOctreePacket(const QByteArray& packet,
|
||||
bool wasStatsPacket, int nodeClockSkewUsec) {
|
||||
const bool wantExtraDebugging = false;
|
||||
|
||||
|
@ -867,20 +867,12 @@ bool OctreeSceneStats::trackIncomingOctreePacket(const QByteArray& packet,
|
|||
qDebug() << "flightTime:" << flightTime << " usecs";
|
||||
}
|
||||
|
||||
|
||||
//qDebug() << "\t" << QString::number(sequence, 16) << "\t sentAt:" << QString::number(sentAt, 16) << " usecs";
|
||||
|
||||
// Guard against possible corrupted packets... with bad timestamps
|
||||
const int MAX_RESONABLE_FLIGHT_TIME = 200 * USECS_PER_SECOND; // 200 seconds is more than enough time for a packet to arrive
|
||||
const int MIN_RESONABLE_FLIGHT_TIME = 0;
|
||||
if (flightTime > MAX_RESONABLE_FLIGHT_TIME || flightTime < MIN_RESONABLE_FLIGHT_TIME) {
|
||||
qDebug() << "ignoring unreasonable packet... flightTime:" << flightTime;
|
||||
qDebug() << "\t sequence:" << QString::number(sequence, 16);
|
||||
qDebug() << "\t sentAt:" << QString::number(sentAt, 16) << " usecs";
|
||||
qDebug() << "\t arrivedAt:" << QString::number(arrivedAt, 16) << " usecs";
|
||||
qDebug() << "\t nodeClockSkewUsec:" << nodeClockSkewUsec << " usecs";
|
||||
qDebug() << "\t flightTime:" << flightTime << " usecs";
|
||||
return true; // ignore any packets that are unreasonable
|
||||
return;
|
||||
}
|
||||
|
||||
// determine our expected sequence number... handle rollover appropriately
|
||||
|
@ -892,7 +884,7 @@ qDebug() << "\t flightTime:" << flightTime << " usecs";
|
|||
int sequenceOffset = (sequence - expected);
|
||||
if (sequenceOffset > MAX_RESONABLE_SEQUENCE_OFFSET || sequenceOffset < MIN_RESONABLE_SEQUENCE_OFFSET) {
|
||||
qDebug() << "ignoring unreasonable packet... sequence:" << sequence << "_incomingLastSequence:" << _incomingLastSequence;
|
||||
return false; // ignore any packets that are unreasonable
|
||||
return; // ignore any packets that are unreasonable
|
||||
}
|
||||
|
||||
// track packets here...
|
||||
|
@ -993,6 +985,6 @@ qDebug() << "\t flightTime:" << flightTime << " usecs";
|
|||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
quint64 getLastFullTotalBytes() const { return _lastFullTotalBytes; }
|
||||
|
||||
// Used in client implementations to track individual octree packets
|
||||
bool trackIncomingOctreePacket(const QByteArray& packet, bool wasStatsPacket, int nodeClockSkewUsec);
|
||||
void trackIncomingOctreePacket(const QByteArray& packet, bool wasStatsPacket, int nodeClockSkewUsec);
|
||||
|
||||
quint32 getIncomingPackets() const { return _incomingPacket; }
|
||||
quint64 getIncomingBytes() const { return _incomingBytes; }
|
||||
|
|
Loading…
Reference in a new issue