Fixed windows build
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "AcknowledgeManager.h"
|
||||
#include <cmath>
|
||||
#include <misc/endianness.h>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace ts;
|
||||
using namespace ts::connection;
|
||||
@@ -107,7 +108,7 @@ ssize_t AcknowledgeManager::execute_resend(const system_clock::time_point& now ,
|
||||
}
|
||||
} else {
|
||||
if(entry->next_resend <= now) {
|
||||
entry->next_resend = now + std::chrono::milliseconds{(int64_t) min(ceil(this->rto), 1500.f)};
|
||||
entry->next_resend = now + std::chrono::milliseconds{(int64_t) std::min(ceil(this->rto), 1500.f)};
|
||||
need_resend.push_back(entry);
|
||||
entry->resend_count++;
|
||||
entry->send_count++;
|
||||
@@ -139,7 +140,7 @@ ssize_t AcknowledgeManager::execute_resend(const system_clock::time_point& now ,
|
||||
/* we're not taking the clock granularity into account because its nearly 1ms and it would only add more branches */
|
||||
void AcknowledgeManager::update_rto(size_t r) {
|
||||
if(srtt == -1) {
|
||||
this->srtt = r;
|
||||
this->srtt = (float) r;
|
||||
this->rttvar = r / 2.f;
|
||||
this->rto = srtt + 4 * this->rttvar;
|
||||
} else {
|
||||
|
||||
@@ -15,22 +15,22 @@ void UnorderedPacketLossCalculator::packet_received(uint32_t packet_id) {
|
||||
|
||||
if(age < this->packet_history.max_bits()) {
|
||||
const auto received = this->packet_history.shift_in_bounds(age).count();
|
||||
this->received_packets_ += received;
|
||||
this->received_packets_total_ += received;
|
||||
this->received_packets_ += (uint32_t) received;
|
||||
this->received_packets_total_ += (uint32_t) received;
|
||||
|
||||
this->lost_packets_ += age - received;
|
||||
this->lost_packets_total_ += age - received;
|
||||
this->lost_packets_ += (uint32_t) (age - received);
|
||||
this->lost_packets_total_ += (uint32_t) (age - received);
|
||||
} else {
|
||||
const auto received = this->packet_history.clear().count();
|
||||
this->received_packets_ += received;
|
||||
this->received_packets_total_ += received;
|
||||
this->lost_packets_ += this->packet_history.max_bits() - received;
|
||||
this->lost_packets_total_ += this->packet_history.max_bits() - received;
|
||||
this->received_packets_ += (uint32_t) received;
|
||||
this->received_packets_total_ += (uint32_t) received;
|
||||
this->lost_packets_ += (uint32_t) (this->packet_history.max_bits() - received);
|
||||
this->lost_packets_total_ += (uint32_t) (this->packet_history.max_bits() - received);
|
||||
|
||||
if(age >= this->packet_history.max_bits() * 2) {
|
||||
this->packet_history.set_unchecked(0);
|
||||
this->lost_packets_ += age - this->packet_history.max_bits() * 2;
|
||||
this->lost_packets_total_ += age - this->packet_history.max_bits() * 2;
|
||||
this->lost_packets_ += (uint32_t) (age - this->packet_history.max_bits() * 2);
|
||||
this->lost_packets_total_ += (uint32_t) (age - this->packet_history.max_bits() * 2);
|
||||
} else {
|
||||
this->packet_history.set_unchecked(age - this->packet_history.max_bits());
|
||||
}
|
||||
@@ -60,8 +60,8 @@ void UnorderedPacketLossCalculator::short_stats() {
|
||||
if(packets_passed < target_interval) return;
|
||||
|
||||
const auto factor = .5;
|
||||
this->received_packets_ *= factor;
|
||||
this->lost_packets_ *= factor;
|
||||
this->received_packets_ = (uint32_t) (this->received_packets_ * factor);
|
||||
this->lost_packets_ = (uint32_t) (this->lost_packets_ * factor);
|
||||
this->last_history_offset = this->packet_history_offset;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace ts::protocol {
|
||||
[[nodiscard]] inline uint32_t received_packets_total() const { return this->received_packets_total_; }
|
||||
[[nodiscard]] inline uint32_t lost_packets_total() const { return this->lost_packets_total_; }
|
||||
|
||||
[[nodiscard]] inline uint32_t unconfirmed_received_packets() const { return this->packet_history.count(); };
|
||||
[[nodiscard]] inline uint32_t unconfirmed_lost_packets() const { return this->packet_history.max_bits() - this->packet_history.count(); };
|
||||
[[nodiscard]] inline uint32_t unconfirmed_received_packets() const { return (uint32_t) this->packet_history.count(); };
|
||||
[[nodiscard]] inline uint32_t unconfirmed_lost_packets() const { return (uint32_t) (this->packet_history.max_bits() - this->packet_history.count()); };
|
||||
|
||||
private:
|
||||
uint32_t received_packets_{0}, received_packets_total_{0}, lost_packets_{0}, lost_packets_total_{0};
|
||||
|
||||
Reference in New Issue
Block a user