mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 23:12:16 +02:00
Merge pull request #14601 from SimonWalton-HiFi/reliable-service-min-timeout
Set minimum timeout for retransmits within reliable network service
This commit is contained in:
commit
87f966773c
2 changed files with 8 additions and 6 deletions
|
@ -61,6 +61,9 @@ private:
|
|||
Mutex2& _mutex2;
|
||||
};
|
||||
|
||||
const microseconds SendQueue::MAXIMUM_ESTIMATED_TIMEOUT = seconds(5);
|
||||
const microseconds SendQueue::MINIMUM_ESTIMATED_TIMEOUT = milliseconds(10);
|
||||
|
||||
std::unique_ptr<SendQueue> SendQueue::create(Socket* socket, HifiSockAddr destination, SequenceNumber currentSequenceNumber,
|
||||
MessageNumber currentMessageNumber, bool hasReceivedHandshakeACK) {
|
||||
Q_ASSERT_X(socket, "SendQueue::create", "Must be called with a valid Socket*");
|
||||
|
@ -507,12 +510,8 @@ bool SendQueue::isInactive(bool attemptedToSendPacket) {
|
|||
|
||||
auto estimatedTimeout = std::chrono::microseconds(_estimatedTimeout);
|
||||
|
||||
// cap our maximum estimated timeout to the already unreasonable 5 seconds
|
||||
const auto MAXIMUM_ESTIMATED_TIMEOUT = std::chrono::seconds(5);
|
||||
|
||||
if (estimatedTimeout > MAXIMUM_ESTIMATED_TIMEOUT) {
|
||||
estimatedTimeout = MAXIMUM_ESTIMATED_TIMEOUT;
|
||||
}
|
||||
// Clamp timeout beween 10 ms and 5 s
|
||||
estimatedTimeout = std::min(MAXIMUM_ESTIMATED_TIMEOUT, std::max(MINIMUM_ESTIMATED_TIMEOUT, estimatedTimeout));
|
||||
|
||||
// use our condition_variable_any to wait
|
||||
auto cvStatus = _emptyCondition.wait_for(locker, estimatedTimeout);
|
||||
|
|
|
@ -140,6 +140,9 @@ private:
|
|||
std::condition_variable_any _emptyCondition;
|
||||
|
||||
std::chrono::high_resolution_clock::time_point _lastPacketSentAt;
|
||||
|
||||
static const std::chrono::microseconds MAXIMUM_ESTIMATED_TIMEOUT;
|
||||
static const std::chrono::microseconds MINIMUM_ESTIMATED_TIMEOUT;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue