mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
removed debug code
This commit is contained in:
parent
f13ae84da6
commit
aa694d6967
14 changed files with 64 additions and 122 deletions
|
@ -388,3 +388,23 @@ const QByteArray* OctreeQueryNode::getNextNackedPacket() {
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void OctreeQueryNode::parseNackPacket(QByteArray& packet) {
|
||||
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(packet);
|
||||
const unsigned char* dataAt = reinterpret_cast<const unsigned char*>(packet.data()) + numBytesPacketHeader;
|
||||
|
||||
uint16_t numSequenceNumbers = (*(uint16_t*)dataAt);
|
||||
dataAt += sizeof(uint16_t);
|
||||
|
||||
printf("\t received nack packet containing %d seq nums\n", numSequenceNumbers);
|
||||
|
||||
// read sequence numbers
|
||||
for (int i = 0; i < numSequenceNumbers; i++) {
|
||||
OCTREE_PACKET_SEQUENCE sequenceNumber = (*(OCTREE_PACKET_SEQUENCE*)dataAt);
|
||||
_nackedSequenceNumbers.enqueue(sequenceNumber);
|
||||
dataAt += sizeof(OCTREE_PACKET_SEQUENCE);
|
||||
|
||||
printf("\t seq = %d\n", sequenceNumber);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#include <OctreeSceneStats.h>
|
||||
#include <ThreadedAssignment.h> // for SharedAssignmentPointer
|
||||
#include "SentPacketHistory.h"
|
||||
|
||||
#include <qqueue.h> // i added dis
|
||||
#include <qqueue.h>
|
||||
|
||||
class OctreeSendThread;
|
||||
|
||||
|
@ -109,9 +108,7 @@ public:
|
|||
|
||||
OCTREE_PACKET_SEQUENCE getSequenceNumber() const { return _sequenceNumber; }
|
||||
|
||||
void addNackedSequenceNumber(OCTREE_PACKET_SEQUENCE sequenceNumber) {
|
||||
_nackedSequenceNumbers.append(sequenceNumber);
|
||||
}
|
||||
void parseNackPacket(QByteArray& packet);
|
||||
bool hasNextNackedPacket() const;
|
||||
const QByteArray* getNextNackedPacket();
|
||||
|
||||
|
@ -158,8 +155,8 @@ private:
|
|||
PacketType _myPacketType;
|
||||
bool _isShuttingDown;
|
||||
|
||||
SentPacketHistory _sentPacketHistory;
|
||||
QQueue<OCTREE_PACKET_SEQUENCE> _nackedSequenceNumbers;
|
||||
SentPacketHistory _sentPacketHistory;
|
||||
QQueue<OCTREE_PACKET_SEQUENCE> _nackedSequenceNumbers;
|
||||
};
|
||||
|
||||
#endif // hifi_OctreeQueryNode_h
|
||||
|
|
|
@ -85,7 +85,7 @@ bool OctreeSendThread::process() {
|
|||
if (nodeData && !nodeData->isShuttingDown()) {
|
||||
bool viewFrustumChanged = nodeData->updateCurrentViewFrustum();
|
||||
packetDistributor(nodeData, viewFrustumChanged);
|
||||
resendNackedPackets(nodeData);
|
||||
resendNackedPackets(nodeData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
|||
|
||||
// actually send it
|
||||
OctreeServer::didCallWriteDatagram(this);
|
||||
NodeList::getInstance()->writeDatagram2(nodeData->getSequenceNumber(), (char*) statsMessage, statsMessageLength, _node);
|
||||
NodeList::getInstance()->writeDatagram((char*) statsMessage, statsMessageLength, _node);
|
||||
packetSent = true;
|
||||
} else {
|
||||
// not enough room in the packet, send two packets
|
||||
|
@ -215,7 +215,7 @@ NodeList::getInstance()->writeDatagram2(nodeData->getSequenceNumber(), (char*) s
|
|||
packetsSent++;
|
||||
|
||||
OctreeServer::didCallWriteDatagram(this);
|
||||
NodeList::getInstance()->writeDatagram2(nodeData->getSequenceNumber(), (char*)nodeData->getPacket(), nodeData->getPacketLength(), _node);
|
||||
NodeList::getInstance()->writeDatagram((char*)nodeData->getPacket(), nodeData->getPacketLength(), _node);
|
||||
packetSent = true;
|
||||
|
||||
thisWastedBytes = MAX_PACKET_SIZE - nodeData->getPacketLength();
|
||||
|
@ -244,7 +244,7 @@ NodeList::getInstance()->writeDatagram2(nodeData->getSequenceNumber(), (char*)no
|
|||
if (nodeData->isPacketWaiting() && !nodeData->isShuttingDown()) {
|
||||
// just send the voxel packet
|
||||
OctreeServer::didCallWriteDatagram(this);
|
||||
NodeList::getInstance()->writeDatagram2(nodeData->getSequenceNumber(), (char*)nodeData->getPacket(), nodeData->getPacketLength(), _node);
|
||||
NodeList::getInstance()->writeDatagram((char*)nodeData->getPacket(), nodeData->getPacketLength(), _node);
|
||||
packetSent = true;
|
||||
|
||||
int thisWastedBytes = MAX_PACKET_SIZE - nodeData->getPacketLength();
|
||||
|
@ -281,10 +281,6 @@ NodeList::getInstance()->writeDatagram2(nodeData->getSequenceNumber(), (char*)no
|
|||
return packetsSent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int OctreeSendThread::resendNackedPackets(OctreeQueryNode* nodeData) {
|
||||
|
||||
const int MAX_PACKETS_RESEND = 10;
|
||||
|
@ -299,20 +295,12 @@ int OctreeSendThread::resendNackedPackets(OctreeQueryNode* nodeData) {
|
|||
|
||||
_totalBytes += packet->size();
|
||||
_totalPackets++;
|
||||
_totalWastedBytes += MAX_PACKET_SIZE - packet->size(); // ???
|
||||
_totalWastedBytes += MAX_PACKET_SIZE - packet->size();
|
||||
}
|
||||
}
|
||||
|
||||
if (packetsSent > 0)
|
||||
printf("\t\t re-sent %d packets!\n", packetsSent);
|
||||
return packetsSent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// Version of voxel distributor that sends the deepest LOD level at once
|
||||
int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrustumChanged) {
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ private:
|
|||
int _nodeMissingCount;
|
||||
bool _isShuttingDown;
|
||||
|
||||
int resendNackedPackets(OctreeQueryNode* nodeData);
|
||||
int resendNackedPackets(OctreeQueryNode* nodeData);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -849,33 +849,15 @@ void OctreeServer::readPendingDatagrams() {
|
|||
}
|
||||
|
||||
} else if (packetType == PacketTypeOctreeDataNack) {
|
||||
|
||||
// parse packet for sequence numbers that need to be resent
|
||||
|
||||
if (matchingNode) {
|
||||
|
||||
OctreeQueryNode* nodeData = (OctreeQueryNode*)matchingNode->getLinkedData();
|
||||
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(receivedPacket);
|
||||
const unsigned char* dataAt = reinterpret_cast<const unsigned char*>(receivedPacket.data()) + numBytesPacketHeader;
|
||||
|
||||
uint16_t numSequenceNumbers = (*(uint16_t*)dataAt);
|
||||
dataAt += sizeof(uint16_t);
|
||||
|
||||
printf("\t received nack packet containing %d seq nums\n", numSequenceNumbers);
|
||||
|
||||
// read sequence numbers
|
||||
for (int i = 0; i < numSequenceNumbers; i++) {
|
||||
OCTREE_PACKET_SEQUENCE sequenceNumber = (*(OCTREE_PACKET_SEQUENCE*)dataAt);
|
||||
nodeData->addNackedSequenceNumber(sequenceNumber);
|
||||
dataAt += sizeof(OCTREE_PACKET_SEQUENCE);
|
||||
|
||||
printf("\t seq = %d\n", sequenceNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If we got a nack packet, then we're talking to an agent, and we
|
||||
// need to make sure we have it in our nodeList.
|
||||
if (matchingNode) {
|
||||
nodeList->updateNodeWithDataFromPacket(matchingNode, receivedPacket);
|
||||
OctreeQueryNode* nodeData = (OctreeQueryNode*)matchingNode->getLinkedData();
|
||||
if (nodeData) {
|
||||
nodeData->parseNackPacket(receivedPacket);
|
||||
}
|
||||
}
|
||||
} else if (packetType == PacketTypeJurisdictionRequest) {
|
||||
_jurisdictionSender->queueReceivedPacket(matchingNode, receivedPacket);
|
||||
} else if (_octreeInboundPacketProcessor && getOctree()->handlesEditPacketType(packetType)) {
|
||||
|
|
|
@ -21,7 +21,8 @@ SentPacketHistory::SentPacketHistory(int size)
|
|||
void SentPacketHistory::packetSent(OCTREE_PACKET_SEQUENCE sequenceNumber, const QByteArray& packet) {
|
||||
_newestSequenceNumber = sequenceNumber;
|
||||
|
||||
// increment _newestPacketAt cyclically, insert new packet there
|
||||
// increment _newestPacketAt cyclically, insert new packet there.
|
||||
// this will overwrite the oldest packet in the buffer
|
||||
_newestPacketAt = (_newestPacketAt == _sentPackets.size() - 1) ? 0 : _newestPacketAt + 1;
|
||||
_sentPackets[_newestPacketAt] = packet;
|
||||
|
||||
|
@ -42,4 +43,4 @@ const QByteArray* SentPacketHistory::getPacket(OCTREE_PACKET_SEQUENCE sequenceNu
|
|||
if (packetAt < 0) { packetAt += _sentPackets.size(); }
|
||||
|
||||
return &_sentPackets.at(packetAt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ public:
|
|||
const QByteArray* getPacket(OCTREE_PACKET_SEQUENCE sequenceNumber) const;
|
||||
|
||||
private:
|
||||
|
||||
QVector<QByteArray> _sentPackets; // circular buffer
|
||||
int _newestPacketAt;
|
||||
int _numExistingPackets;
|
||||
|
|
|
@ -2095,33 +2095,17 @@ void Application::updateMyAvatar(float deltaTime) {
|
|||
}
|
||||
}
|
||||
|
||||
// sent a nack packet containing missing sequence numbers of received packets
|
||||
{
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64 sinceLastNack = now - _lastNackTime;
|
||||
const quint64 TOO_LONG_SINCE_LAST_NACK = 250 * MSECS_PER_SECOND;
|
||||
if (sinceLastNack > TOO_LONG_SINCE_LAST_NACK) {
|
||||
_lastNackTime = now;
|
||||
sendNack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*/ Attempt to identify the sender from it's address.
|
||||
if (sendingNode) {
|
||||
QUuid nodeUUID = sendingNode->getUUID();
|
||||
|
||||
// now that we know the node ID, let's add these stats to the stats for that node...
|
||||
_octreeSceneStatsLock.lockForWrite();
|
||||
if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
|
||||
OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];
|
||||
stats.trackIncomingOctreePacket(packet, wasStatsPacket, sendingNode->getClockSkewUsec());
|
||||
// sent a nack packet containing missing sequence numbers of received packets
|
||||
{
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64 sinceLastNack = now - _lastNackTime;
|
||||
const quint64 TOO_LONG_SINCE_LAST_NACK = 250 * MSECS_PER_SECOND;
|
||||
if (sinceLastNack > TOO_LONG_SINCE_LAST_NACK) {
|
||||
_lastNackTime = now;
|
||||
sendNack();
|
||||
}
|
||||
_octreeSceneStatsLock.unlock();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Application::sendNack() {
|
||||
|
||||
|
@ -2139,7 +2123,6 @@ void Application::sendNack() {
|
|||
|
||||
QUuid nodeUUID = node->getUUID();
|
||||
|
||||
|
||||
_octreeSceneStatsLock.lockForWrite();
|
||||
|
||||
// retreive octree scene stats of this node
|
||||
|
@ -2172,15 +2155,11 @@ void Application::sendNack() {
|
|||
dataAt += sizeof(uint16_t);
|
||||
|
||||
// pack sequence numbers
|
||||
//printf("\n\t sending nack...\n");
|
||||
//printf("\t\t packed %d seq #s:", numSequenceNumbers);
|
||||
for (int i = 0; i < numSequenceNumbers; i++) {
|
||||
OCTREE_PACKET_SEQUENCE* sequenceNumberAt = (OCTREE_PACKET_SEQUENCE*)dataAt;
|
||||
*sequenceNumberAt = stats.getNextSequenceNumberToNack();
|
||||
dataAt += sizeof(OCTREE_PACKET_SEQUENCE);
|
||||
//printf(" %d,", *sequenceNumberAt);
|
||||
}
|
||||
//printf("\n");
|
||||
|
||||
_octreeSceneStatsLock.unlock();
|
||||
|
||||
|
@ -2189,9 +2168,6 @@ void Application::sendNack() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
|
||||
|
||||
// if voxels are disabled, then don't send this at all...
|
||||
|
|
|
@ -413,8 +413,6 @@ private:
|
|||
|
||||
void sendNack();
|
||||
|
||||
|
||||
|
||||
MainWindow* _window;
|
||||
GLCanvas* _glWidget; // our GLCanvas has a couple extra features
|
||||
|
||||
|
@ -585,7 +583,7 @@ private:
|
|||
|
||||
QSystemTrayIcon* _trayIcon;
|
||||
|
||||
quint64 _lastNackTime;
|
||||
quint64 _lastNackTime;
|
||||
};
|
||||
|
||||
#endif // hifi_Application_h
|
||||
|
|
|
@ -271,23 +271,6 @@ qint64 LimitedNodeList::writeDatagram(const char* data, qint64 size, const Share
|
|||
return writeDatagram(QByteArray(data, size), destinationNode, overridenSockAddr);
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::writeDatagram2(int seq, const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
||||
const HifiSockAddr& overridenSockAddr) {
|
||||
|
||||
qint64 ret = -1;
|
||||
|
||||
if (randFloat() < 0.8f) {
|
||||
ret = writeDatagram(QByteArray(data, size), destinationNode, overridenSockAddr);
|
||||
}
|
||||
else {
|
||||
printf("dropped packet seq = %d --------------------------\n", seq);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
qint64 LimitedNodeList::writeUnverifiedDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
||||
const HifiSockAddr& overridenSockAddr) {
|
||||
return writeUnverifiedDatagram(QByteArray(data, size), destinationNode, overridenSockAddr);
|
||||
|
|
|
@ -72,9 +72,6 @@ public:
|
|||
qint64 writeDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
||||
const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
||||
|
||||
qint64 writeDatagram2(int seq, const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
||||
const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
||||
|
||||
qint64 writeUnverifiedDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
||||
const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ const QSet<PacketType> NON_VERIFIED_PACKETS = QSet<PacketType>()
|
|||
<< PacketTypeDomainList << PacketTypeDomainListRequest << PacketTypeDomainOAuthRequest
|
||||
<< PacketTypeCreateAssignment << PacketTypeRequestAssignment << PacketTypeStunResponse
|
||||
<< PacketTypeNodeJsonStats << PacketTypeVoxelQuery << PacketTypeParticleQuery << PacketTypeModelQuery
|
||||
<< PacketTypeOctreeDataNack;
|
||||
<< PacketTypeOctreeDataNack;
|
||||
|
||||
const int NUM_BYTES_MD5_HASH = 16;
|
||||
const int NUM_STATIC_HEADER_BYTES = sizeof(PacketVersion) + NUM_BYTES_RFC4122_UUID;
|
||||
|
|
|
@ -46,7 +46,7 @@ OctreeSceneStats::OctreeSceneStats() :
|
|||
_incomingReallyLate(0),
|
||||
_incomingPossibleDuplicate(0),
|
||||
_missingSequenceNumbers(),
|
||||
_sequenceNumbersToNack(),
|
||||
_sequenceNumbersToNack(),
|
||||
_incomingFlightTimeAverage(samples),
|
||||
_jurisdictionRoot(NULL)
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ void OctreeSceneStats::copyFromOther(const OctreeSceneStats& other) {
|
|||
_incomingPossibleDuplicate = other._incomingPossibleDuplicate;
|
||||
|
||||
_missingSequenceNumbers = other._missingSequenceNumbers;
|
||||
_sequenceNumbersToNack = other._sequenceNumbersToNack;
|
||||
_sequenceNumbersToNack = other._sequenceNumbersToNack;
|
||||
}
|
||||
|
||||
|
||||
|
@ -928,7 +928,7 @@ void OctreeSceneStats::trackIncomingOctreePacket(const QByteArray& packet,
|
|||
qDebug() << "found it in _missingSequenceNumbers";
|
||||
}
|
||||
_missingSequenceNumbers.remove(sequence);
|
||||
_sequenceNumbersToNack.remove(sequence);
|
||||
_sequenceNumbersToNack.remove(sequence);
|
||||
_incomingLikelyLost--;
|
||||
_incomingRecovered++;
|
||||
} else {
|
||||
|
@ -958,7 +958,7 @@ _sequenceNumbersToNack.remove(sequence);
|
|||
_incomingLikelyLost += missing;
|
||||
for(unsigned int missingSequence = expected; missingSequence < sequence; missingSequence++) {
|
||||
_missingSequenceNumbers << missingSequence;
|
||||
_sequenceNumbersToNack << missingSequence;
|
||||
_sequenceNumbersToNack << missingSequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -986,7 +986,7 @@ _sequenceNumbersToNack << missingSequence;
|
|||
qDebug() << "pruning really old missing sequence:" << missingItem;
|
||||
}
|
||||
_missingSequenceNumbers.remove(missingItem);
|
||||
_sequenceNumbersToNack.remove(missingItem);
|
||||
_sequenceNumbersToNack.remove(missingItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1002,4 +1002,4 @@ uint16_t OctreeSceneStats::getNextSequenceNumberToNack() {
|
|||
uint16_t sequenceNumber = *it;
|
||||
_sequenceNumbersToNack.remove(sequenceNumber);
|
||||
return sequenceNumber;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <NodeList.h>
|
||||
#include <SharedUtil.h>
|
||||
#include "JurisdictionMap.h"
|
||||
#include "OctreePacketData.h"
|
||||
|
||||
#define GREENISH 0x40ff40d0
|
||||
#define YELLOWISH 0xffef40c0
|
||||
|
@ -172,8 +173,8 @@ public:
|
|||
quint32 getIncomingPossibleDuplicate() const { return _incomingPossibleDuplicate; }
|
||||
float getIncomingFlightTimeAverage() { return _incomingFlightTimeAverage.getAverage(); }
|
||||
|
||||
int getNumSequenceNumbersToNack() const;
|
||||
uint16_t getNextSequenceNumberToNack();
|
||||
int getNumSequenceNumbersToNack() const;
|
||||
OCTREE_PACKET_SEQUENCE getNextSequenceNumberToNack();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -275,8 +276,8 @@ private:
|
|||
quint32 _incomingLate; /// out of order later than expected
|
||||
quint32 _incomingReallyLate; /// out of order and later than MAX_MISSING_SEQUENCE_OLD_AGE late
|
||||
quint32 _incomingPossibleDuplicate; /// out of order possibly a duplicate
|
||||
QSet<uint16_t> _missingSequenceNumbers;
|
||||
QSet<uint16_t> _sequenceNumbersToNack;
|
||||
QSet<OCTREE_PACKET_SEQUENCE> _missingSequenceNumbers;
|
||||
QSet<OCTREE_PACKET_SEQUENCE> _sequenceNumbersToNack;
|
||||
SimpleMovingAverage _incomingFlightTimeAverage;
|
||||
|
||||
// features related items
|
||||
|
|
Loading…
Reference in a new issue