mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 18:55:01 +02:00
removed debug code
This commit is contained in:
parent
8187912384
commit
011e7c2de2
4 changed files with 6 additions and 41 deletions
|
@ -204,7 +204,6 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
|||
|
||||
// check if this node is still alive. Remove its stats if it's dead.
|
||||
if (!isAlive(nodeUUID)) {
|
||||
printf("\t\t removing node %s\n", nodeUUID.toString().toLatin1().data());
|
||||
i = _singleSenderStats.erase(i);
|
||||
continue;
|
||||
}
|
||||
|
@ -244,12 +243,10 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
|||
dataAt += sizeof(uint16_t);
|
||||
|
||||
// pack sequence numbers to nack
|
||||
printf("\t\t sending NACK with %d seq numbers:\n\t\t", numSequenceNumbers);
|
||||
for (uint16_t i = 0; i < numSequenceNumbers; i++) {
|
||||
unsigned short int* sequenceNumberAt = (unsigned short int*)dataAt;
|
||||
*sequenceNumberAt = *missingSequenceNumberIterator;
|
||||
dataAt += sizeof(unsigned short int);
|
||||
printf("%d, ", *missingSequenceNumberIterator);
|
||||
|
||||
missingSequenceNumberIterator++;
|
||||
}
|
||||
|
@ -257,7 +254,6 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
|||
|
||||
// send it
|
||||
qint64 bytesWritten = NodeList::getInstance()->writeDatagram(packet, dataAt - packet, destinationNode);
|
||||
printf("\t\t wrote %lld bytes\n\n", bytesWritten);
|
||||
|
||||
packetsSent++;
|
||||
}
|
||||
|
@ -282,8 +278,6 @@ SingleSenderStats::SingleSenderStats()
|
|||
void SingleSenderStats::trackInboundPacket(unsigned short int incomingSequence, quint64 transitTime,
|
||||
int editsInPacket, quint64 processTime, quint64 lockWaitTime) {
|
||||
|
||||
printf("\t\t tracked seq %hu\n", incomingSequence);
|
||||
|
||||
const int UINT16_RANGE = UINT16_MAX + 1;
|
||||
|
||||
const int MAX_REASONABLE_SEQUENCE_GAP = 1000; // this must be less than UINT16_RANGE / 2 for rollover handling to work
|
||||
|
@ -321,8 +315,6 @@ printf("\t\t tracked seq %hu\n", incomingSequence);
|
|||
|
||||
if (incoming > expected) { // early
|
||||
|
||||
printf("\t\t\t packet is early! %d packets were skipped\n", incoming - expected);
|
||||
|
||||
// add all sequence numbers that were skipped to the missing sequence numbers list
|
||||
for (int missingSequence = expected; missingSequence < incoming; missingSequence++) {
|
||||
_missingSequenceNumbers.insert(missingSequence < 0 ? missingSequence + UINT16_RANGE : missingSequence);
|
||||
|
@ -331,14 +323,10 @@ printf("\t\t tracked seq %hu\n", incomingSequence);
|
|||
|
||||
} else { // late
|
||||
|
||||
printf("\t\t\t packet is late!\n");
|
||||
|
||||
// remove this from missing sequence number if it's in there
|
||||
if (_missingSequenceNumbers.remove(incomingSequence)) {
|
||||
printf("\t\t\t\t packet %d recovered!!!\n", incomingSequence);
|
||||
}
|
||||
_missingSequenceNumbers.remove(incomingSequence);
|
||||
|
||||
// do not update _incomingLastSequence
|
||||
// do not update _incomingLastSequence; it shouldn't become smaller
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,4 +361,4 @@ printf("\t\t tracked seq %hu\n", incomingSequence);
|
|||
_totalLockWaitTime += lockWaitTime;
|
||||
_totalElementsInPacket += editsInPacket;
|
||||
_totalPackets++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ public:
|
|||
void trackInboundPacket(unsigned short int incomingSequence, quint64 transitTime,
|
||||
int editsInPacket, quint64 processTime, quint64 lockWaitTime);
|
||||
|
||||
|
||||
quint64 _totalTransitTime;
|
||||
quint64 _totalProcessTime;
|
||||
quint64 _totalLockWaitTime;
|
||||
|
@ -95,7 +94,7 @@ private:
|
|||
quint64 _totalLockWaitTime;
|
||||
quint64 _totalElementsInPacket;
|
||||
quint64 _totalPackets;
|
||||
|
||||
|
||||
NodeToSenderStatsMap _singleSenderStats;
|
||||
|
||||
quint64 _lastNackTime;
|
||||
|
|
|
@ -54,5 +54,4 @@ void ReceivedPacketProcessor::nodeKilled(SharedNodePointer node) {
|
|||
lock();
|
||||
_nodePacketCounts.remove(node->getUUID());
|
||||
unlock();
|
||||
printf("\n\t\t nodeKilled()!!!!! --------------------------\n\n");
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ OctreeEditPacketSender::OctreeEditPacketSender() :
|
|||
_maxPendingMessages(DEFAULT_MAX_PENDING_MESSAGES),
|
||||
_releaseQueuedMessagesPending(false),
|
||||
_serverJurisdictions(NULL),
|
||||
_sequenceNumber(65500),
|
||||
_sequenceNumber(0),
|
||||
_maxPacketSize(MAX_PACKET_SIZE) {
|
||||
}
|
||||
|
||||
|
@ -98,36 +98,15 @@ void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, const unsi
|
|||
if (node->getActiveSocket()) {
|
||||
QByteArray packet(reinterpret_cast<const char*>(buffer), length);
|
||||
|
||||
bool send = randFloat() < 0.7f;
|
||||
if (send)
|
||||
queuePacketForSending(node, packet);
|
||||
|
||||
// extract sequence number and add packet to history
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(packet);
|
||||
const char* dataAt = reinterpret_cast<const char*>(packet.data()) + numBytesPacketHeader;
|
||||
unsigned short int sequence = *((unsigned short int*)dataAt);
|
||||
/*
|
||||
// debug
|
||||
dataAt += sizeof(unsigned short int);
|
||||
|
||||
// extract time stamp
|
||||
quint64 sentTime = *((quint64*)dataAt);
|
||||
dataAt += sizeof(quint64);
|
||||
|
||||
PacketType type = packetTypeForPacket(packet);
|
||||
|
||||
|
||||
printf("adding packet to history. size: %d\n", packet.length());
|
||||
printf("type: %d, seq: %hu, time: %llu\n", (unsigned char)type, sequence, sentTime);
|
||||
printf("destination node: %s\n", nodeUUID.toString().toLatin1().data());
|
||||
fflush(stdout);
|
||||
*/
|
||||
|
||||
_sentPacketHistories[nodeUUID].packetSent(sequence, packet);
|
||||
|
||||
if (!send) {
|
||||
printf("\t dropped packet %d !!! ---------------------------\n", sequence);
|
||||
}
|
||||
|
||||
// debugging output...
|
||||
bool wantDebugging = false;
|
||||
if (wantDebugging) {
|
||||
|
|
Loading…
Reference in a new issue