mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
address comments in code review
This commit is contained in:
parent
21c80e45c2
commit
dcd5a4aec2
3 changed files with 8 additions and 14 deletions
|
@ -23,13 +23,12 @@ void FileResourceRequest::doSend() {
|
||||||
if (file.open(QFile::ReadOnly)) {
|
if (file.open(QFile::ReadOnly)) {
|
||||||
_data = file.readAll();
|
_data = file.readAll();
|
||||||
_result = ResourceRequest::Success;
|
_result = ResourceRequest::Success;
|
||||||
emit finished();
|
|
||||||
} else {
|
} else {
|
||||||
_result = ResourceRequest::AccessDenied;
|
_result = ResourceRequest::AccessDenied;
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_result = ResourceRequest::NotFound;
|
_result = ResourceRequest::NotFound;
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,14 +304,13 @@ void SendQueue::run() {
|
||||||
handshakeLock.unlock();
|
handshakeLock.unlock();
|
||||||
|
|
||||||
bool sentAPacket = maybeResendPacket();
|
bool sentAPacket = maybeResendPacket();
|
||||||
bool flowWindowFull = false;
|
|
||||||
|
|
||||||
// if we didn't find a packet to re-send AND we think we can fit a new packet on the wire
|
// if we didn't find a packet to re-send AND we think we can fit a new packet on the wire
|
||||||
// (this is according to the current flow window size) then we send out a new packet
|
// (this is according to the current flow window size) then we send out a new packet
|
||||||
if (_hasReceivedHandshakeACK && !sentAPacket) {
|
if (_hasReceivedHandshakeACK && !sentAPacket) {
|
||||||
flowWindowFull = (seqlen(SequenceNumber { (uint32_t) _lastACKSequenceNumber }, _currentSequenceNumber) >
|
if (seqlen(SequenceNumber { (uint32_t) _lastACKSequenceNumber }, _currentSequenceNumber) > _flowWindowSize) {
|
||||||
_flowWindowSize);
|
sentAPacket = maybeSendNewPacket();
|
||||||
sentAPacket = maybeSendNewPacket();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// since we're a while loop, give the thread a chance to process events
|
// since we're a while loop, give the thread a chance to process events
|
||||||
|
@ -354,17 +353,17 @@ void SendQueue::run() {
|
||||||
if (uint32_t(_lastACKSequenceNumber) == uint32_t(_currentSequenceNumber)) {
|
if (uint32_t(_lastACKSequenceNumber) == uint32_t(_currentSequenceNumber)) {
|
||||||
// we've sent the client as much data as we have (and they've ACKed it)
|
// we've sent the client as much data as we have (and they've ACKed it)
|
||||||
// either wait for new data to send or 5 seconds before cleaning up the queue
|
// either wait for new data to send or 5 seconds before cleaning up the queue
|
||||||
static const auto EMPTY_QUEUES_INACTIVE_TIMEOUT_US = std::chrono::microseconds(5 * 1000 * 1000);
|
static const auto EMPTY_QUEUES_INACTIVE_TIMEOUT = std::chrono::seconds(5 * 1000 * 1000);
|
||||||
|
|
||||||
// use our condition_variable_any to wait
|
// use our condition_variable_any to wait
|
||||||
auto cvStatus = _emptyCondition.wait_for(doubleLock, EMPTY_QUEUES_INACTIVE_TIMEOUT_US);
|
auto cvStatus = _emptyCondition.wait_for(doubleLock, EMPTY_QUEUES_INACTIVE_TIMEOUT);
|
||||||
|
|
||||||
// we have the double lock again - Make sure to unlock it
|
// we have the double lock again - Make sure to unlock it
|
||||||
doubleLock.unlock();
|
doubleLock.unlock();
|
||||||
|
|
||||||
if (cvStatus == std::cv_status::timeout) {
|
if (cvStatus == std::cv_status::timeout) {
|
||||||
qDebug() << "SendQueue to" << _destination << "has been empty for"
|
qDebug() << "SendQueue to" << _destination << "has been empty for"
|
||||||
<< std::chrono::duration_cast<std::chrono::seconds>(EMPTY_QUEUES_INACTIVE_TIMEOUT_US).count()
|
<< EMPTY_QUEUES_INACTIVE_TIMEOUT.count()
|
||||||
<< "seconds and receiver has ACKed all packets."
|
<< "seconds and receiver has ACKed all packets."
|
||||||
<< "The queue is considered inactive and will be stopped.";
|
<< "The queue is considered inactive and will be stopped.";
|
||||||
|
|
||||||
|
|
|
@ -111,10 +111,6 @@ private:
|
||||||
|
|
||||||
std::atomic<int> _flowWindowSize { 0 }; // Flow control window size (number of packets that can be on wire) - set from CC
|
std::atomic<int> _flowWindowSize { 0 }; // Flow control window size (number of packets that can be on wire) - set from CC
|
||||||
|
|
||||||
// Used to detect when the connection becomes inactive for too long
|
|
||||||
bool _flowWindowWasFull = false;
|
|
||||||
time_point _flowWindowFullSince;
|
|
||||||
|
|
||||||
mutable std::mutex _naksLock; // Protects the naks list.
|
mutable std::mutex _naksLock; // Protects the naks list.
|
||||||
LossList _naks; // Sequence numbers of packets to resend
|
LossList _naks; // Sequence numbers of packets to resend
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue