dont count timed-out as in-flight bytes
This commit is contained in:
@@ -53,7 +53,7 @@ struct CCAI {
|
|||||||
virtual int64_t canSend(float time_delta) = 0;
|
virtual int64_t canSend(float time_delta) = 0;
|
||||||
|
|
||||||
// get the list of timed out seq_ids
|
// get the list of timed out seq_ids
|
||||||
virtual std::vector<SeqIDType> getTimeouts(void) const = 0;
|
virtual std::vector<SeqIDType> getTimeouts(void) = 0;
|
||||||
|
|
||||||
// returns -1 if not implemented, can return 0
|
// returns -1 if not implemented, can return 0
|
||||||
virtual int64_t inFlightCount(void) const { return -1; }
|
virtual int64_t inFlightCount(void) const { return -1; }
|
||||||
|
|||||||
@@ -86,15 +86,21 @@ int64_t FlowOnly::canSend(float time_delta) {
|
|||||||
return (fspace / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;
|
return (fspace / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FlowOnly::SeqIDType> FlowOnly::getTimeouts(void) const {
|
std::vector<FlowOnly::SeqIDType> FlowOnly::getTimeouts(void) {
|
||||||
std::vector<SeqIDType> list;
|
std::vector<SeqIDType> list;
|
||||||
list.reserve(_in_flight.size()/3); // we dont know, so we just guess
|
list.reserve(_in_flight.size()/3); // we dont know, so we just guess
|
||||||
|
|
||||||
// after 3 rtt delay, we trigger timeout
|
// after 3 rtt delay, we trigger timeout
|
||||||
const auto now_adjusted = getTimeNow() - getCurrentDelay()*3.f;
|
const auto now_adjusted = getTimeNow() - getCurrentDelay()*3.f;
|
||||||
|
|
||||||
for (const auto& [seq, time_stamp, size, _] : _in_flight) {
|
for (auto& [seq, time_stamp, size, acc, _] : _in_flight) {
|
||||||
if (now_adjusted > time_stamp) {
|
if (now_adjusted > time_stamp) {
|
||||||
|
// make it so timed out packets no longer count as in-flight
|
||||||
|
if (acc) {
|
||||||
|
acc = false;
|
||||||
|
_in_flight_bytes -= size;
|
||||||
|
assert(_in_flight_bytes >= 0);
|
||||||
|
}
|
||||||
list.push_back(seq);
|
list.push_back(seq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,7 +121,9 @@ void FlowOnly::onSent(SeqIDType seq, size_t data_size) {
|
|||||||
size_t sum {0u};
|
size_t sum {0u};
|
||||||
for (const auto& it : _in_flight) {
|
for (const auto& it : _in_flight) {
|
||||||
assert(it.id != seq);
|
assert(it.id != seq);
|
||||||
sum += it.bytes;
|
if (it.accounted) {
|
||||||
|
sum += it.bytes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assert(_in_flight_bytes == sum);
|
assert(_in_flight_bytes == sum);
|
||||||
}
|
}
|
||||||
@@ -125,6 +133,7 @@ void FlowOnly::onSent(SeqIDType seq, size_t data_size) {
|
|||||||
seq,
|
seq,
|
||||||
static_cast<float>(getTimeNow()),
|
static_cast<float>(getTimeNow()),
|
||||||
data_size + SEGMENT_OVERHEAD,
|
data_size + SEGMENT_OVERHEAD,
|
||||||
|
true,
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -184,8 +193,10 @@ void FlowOnly::onAck(std::vector<SeqIDType> seqs) {
|
|||||||
continue; // not found, ignore
|
continue; // not found, ignore
|
||||||
} else {
|
} else {
|
||||||
//most_recent = std::max(most_recent, std::get<1>(*it));
|
//most_recent = std::max(most_recent, std::get<1>(*it));
|
||||||
_in_flight_bytes -= it->bytes;
|
if (it->accounted) {
|
||||||
assert(_in_flight_bytes >= 0);
|
_in_flight_bytes -= it->bytes;
|
||||||
|
assert(_in_flight_bytes >= 0);
|
||||||
|
}
|
||||||
//_recently_acked_data += std::get<2>(*it);
|
//_recently_acked_data += std::get<2>(*it);
|
||||||
_in_flight.erase(it);
|
_in_flight.erase(it);
|
||||||
}
|
}
|
||||||
@@ -207,9 +218,14 @@ void FlowOnly::onLoss(SeqIDType seq, bool discard) {
|
|||||||
|
|
||||||
// "if data lost is not to be retransmitted"
|
// "if data lost is not to be retransmitted"
|
||||||
if (discard) {
|
if (discard) {
|
||||||
_in_flight_bytes -= it->bytes;
|
if (it->accounted) {
|
||||||
assert(_in_flight_bytes >= 0);
|
_in_flight_bytes -= it->bytes;
|
||||||
|
assert(_in_flight_bytes >= 0);
|
||||||
|
}
|
||||||
_in_flight.erase(it);
|
_in_flight.erase(it);
|
||||||
|
if (_in_flight.empty()) {
|
||||||
|
assert(_in_flight_bytes == 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// and not take into rtt
|
// and not take into rtt
|
||||||
it->timestamp = getTimeNow();
|
it->timestamp = getTimeNow();
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ struct FlowOnly : public CCAI {
|
|||||||
float timestamp;
|
float timestamp;
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
|
|
||||||
// set to true if counted as ce or resent due to timeout
|
// unset if it does not count torwards _in_flight_bytes
|
||||||
|
bool accounted {true};
|
||||||
|
|
||||||
|
// set if counted as ce or resent due to timeout
|
||||||
bool ignore {false};
|
bool ignore {false};
|
||||||
};
|
};
|
||||||
std::vector<FlyingBunch> _in_flight;
|
std::vector<FlyingBunch> _in_flight;
|
||||||
@@ -71,7 +74,7 @@ struct FlowOnly : public CCAI {
|
|||||||
int64_t canSend(float time_delta) override;
|
int64_t canSend(float time_delta) override;
|
||||||
|
|
||||||
// get the list of timed out seq_ids
|
// get the list of timed out seq_ids
|
||||||
std::vector<SeqIDType> getTimeouts(void) const override;
|
std::vector<SeqIDType> getTimeouts(void) override;
|
||||||
|
|
||||||
int64_t inFlightCount(void) const override;
|
int64_t inFlightCount(void) const override;
|
||||||
int64_t inFlightBytes(void) const override;
|
int64_t inFlightBytes(void) const override;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ int64_t LEDBAT::canSend(float time_delta) {
|
|||||||
return std::ceil(std::min<float>(cspace, fspace) / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;
|
return std::ceil(std::min<float>(cspace, fspace) / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<LEDBAT::SeqIDType> LEDBAT::getTimeouts(void) const {
|
std::vector<LEDBAT::SeqIDType> LEDBAT::getTimeouts(void) {
|
||||||
std::vector<LEDBAT::SeqIDType> list;
|
std::vector<LEDBAT::SeqIDType> list;
|
||||||
|
|
||||||
// after 2 delays we trigger timeout
|
// after 2 delays we trigger timeout
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ struct LEDBAT : public CCAI {
|
|||||||
int64_t canSend(float time_delta) override;
|
int64_t canSend(float time_delta) override;
|
||||||
|
|
||||||
// get the list of timed out seq_ids
|
// get the list of timed out seq_ids
|
||||||
std::vector<SeqIDType> getTimeouts(void) const override;
|
std::vector<SeqIDType> getTimeouts(void) override;
|
||||||
|
|
||||||
public: // callbacks
|
public: // callbacks
|
||||||
// data size is without overhead
|
// data size is without overhead
|
||||||
|
|||||||
Reference in New Issue
Block a user