mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 14:03:17 +02:00
repairs while testing with UDTTest
This commit is contained in:
parent
805c5a6aff
commit
8e786cb953
4 changed files with 30 additions and 30 deletions
|
@ -203,20 +203,22 @@ void Connection::sendNAK(SequenceNumber sequenceNumberRecieved) {
|
|||
}
|
||||
|
||||
void Connection::sendTimeoutNAK() {
|
||||
// construct a NAK packet that will hold all of the lost sequence numbers
|
||||
// TODO size is wrong, fix it.
|
||||
auto lossListPacket = ControlPacket::create(ControlPacket::TimeoutNAK, _lossList.getLength() * sizeof(SequenceNumber));
|
||||
|
||||
// Pack in the lost sequence numbers
|
||||
_lossList.write(*lossListPacket);
|
||||
|
||||
// have our SendQueue send off this control packet
|
||||
_sendQueue->sendPacket(*lossListPacket);
|
||||
|
||||
// record this as the last NAK time
|
||||
_lastNAKTime = high_resolution_clock::now();
|
||||
|
||||
_stats.recordSentTimeoutNAK();
|
||||
if (_lossList.getLength() > 0) {
|
||||
// construct a NAK packet that will hold all of the lost sequence numbers
|
||||
// TODO size is wrong, fix it.
|
||||
auto lossListPacket = ControlPacket::create(ControlPacket::TimeoutNAK, _lossList.getLength() * sizeof(SequenceNumber));
|
||||
|
||||
// Pack in the lost sequence numbers
|
||||
_lossList.write(*lossListPacket);
|
||||
|
||||
// have our SendQueue send off this control packet
|
||||
_sendQueue->sendPacket(*lossListPacket);
|
||||
|
||||
// record this as the last NAK time
|
||||
_lastNAKTime = high_resolution_clock::now();
|
||||
|
||||
_stats.recordSentTimeoutNAK();
|
||||
}
|
||||
}
|
||||
|
||||
SequenceNumber Connection::nextACK() const {
|
||||
|
|
|
@ -58,19 +58,6 @@ void SendQueue::queuePacket(std::unique_ptr<Packet> packet) {
|
|||
}
|
||||
}
|
||||
|
||||
void SendQueue::run() {
|
||||
// We need to make sure this is called on the right thread
|
||||
if (thread() != QThread::currentThread()) {
|
||||
QMetaObject::invokeMethod(this, "run", Qt::QueuedConnection);
|
||||
return;
|
||||
}
|
||||
|
||||
_isRunning = true;
|
||||
|
||||
// This will loop and sleep to send packets
|
||||
loop();
|
||||
}
|
||||
|
||||
void SendQueue::stop() {
|
||||
_isRunning = false;
|
||||
}
|
||||
|
@ -128,7 +115,16 @@ SequenceNumber SendQueue::getNextSequenceNumber() {
|
|||
return _currentSequenceNumber;
|
||||
}
|
||||
|
||||
void SendQueue::loop() {
|
||||
void SendQueue::run() {
|
||||
|
||||
// We need to make sure this is called on the right thread
|
||||
if (thread() != QThread::currentThread()) {
|
||||
QMetaObject::invokeMethod(this, "run", Qt::QueuedConnection);
|
||||
return;
|
||||
}
|
||||
|
||||
_isRunning = true;
|
||||
|
||||
while (_isRunning) {
|
||||
// Record timing
|
||||
_lastSendTimestamp = high_resolution_clock::now();
|
||||
|
@ -170,6 +166,7 @@ void SendQueue::loop() {
|
|||
}
|
||||
|
||||
if (nextPacket) {
|
||||
qDebug() << "the next packet is" << nextPacket->getDataSize() << "bytes";
|
||||
bool shouldSendSecondOfPair = false;
|
||||
|
||||
if (!hasResend) {
|
||||
|
|
|
@ -55,7 +55,6 @@ public:
|
|||
void sendPacket(const BasePacket& packet);
|
||||
|
||||
public slots:
|
||||
void run();
|
||||
void stop();
|
||||
|
||||
void ack(SequenceNumber ack);
|
||||
|
@ -66,7 +65,7 @@ signals:
|
|||
void packetSent();
|
||||
|
||||
private slots:
|
||||
void loop();
|
||||
void run();
|
||||
|
||||
private:
|
||||
SendQueue(Socket* socket, HifiSockAddr dest);
|
||||
|
|
|
@ -66,6 +66,7 @@ UDTTest::UDTTest(int& argc, char** argv) :
|
|||
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
||||
} else {
|
||||
_target = HifiSockAddr(address, port);
|
||||
qDebug() << "Packets will be sent to" << _target;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,6 +185,7 @@ void UDTTest::sendPacket() {
|
|||
}
|
||||
|
||||
auto newPacket = udt::Packet::create(packetPayloadSize, _sendReliable);
|
||||
newPacket->setPayloadSize(packetPayloadSize);
|
||||
|
||||
_totalQueuedBytes += newPacket->getDataSize();
|
||||
|
||||
|
|
Loading…
Reference in a new issue