accounted
This commit is contained in:
parent
2a0350a564
commit
d88c73c761
@ -61,6 +61,10 @@ struct CCAI {
|
|||||||
// returns -1 if not implemented, can return 0
|
// returns -1 if not implemented, can return 0
|
||||||
virtual int64_t inFlightBytes(void) const { return -1; }
|
virtual int64_t inFlightBytes(void) const { return -1; }
|
||||||
|
|
||||||
|
// returns -1 if not implemented, can return 0
|
||||||
|
// excluded timed out packets (not those currently resent)
|
||||||
|
virtual int64_t inFlightBytesAccounted(void) const { return -1; }
|
||||||
|
|
||||||
public: // callbacks
|
public: // callbacks
|
||||||
// data size is without overhead
|
// data size is without overhead
|
||||||
virtual void onSent(SeqIDType seq, size_t data_size) = 0;
|
virtual void onSent(SeqIDType seq, size_t data_size) = 0;
|
||||||
|
@ -93,7 +93,8 @@ int64_t CUBIC::canSend(float time_delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto window = getCWnD();
|
const auto window = getCWnD();
|
||||||
int64_t cspace_bytes = window - _in_flight_bytes;
|
//int64_t cspace_bytes = window - _in_flight_bytes;
|
||||||
|
int64_t cspace_bytes = window - _in_flight_bytes_accounted;
|
||||||
if (cspace_bytes < MAXIMUM_SEGMENT_DATA_SIZE) {
|
if (cspace_bytes < MAXIMUM_SEGMENT_DATA_SIZE) {
|
||||||
//std::cerr << "CUBIC: cspace < seg size\n";
|
//std::cerr << "CUBIC: cspace < seg size\n";
|
||||||
return 0u;
|
return 0u;
|
||||||
|
@ -29,6 +29,25 @@ void FlowOnly::updateWindow(void) {
|
|||||||
_fwnd = std::max(_fwnd, 2.f * MAXIMUM_SEGMENT_DATA_SIZE);
|
_fwnd = std::max(_fwnd, 2.f * MAXIMUM_SEGMENT_DATA_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlowOnly::updateAccounted(void) {
|
||||||
|
int64_t size_timedout {0};
|
||||||
|
|
||||||
|
{ // can be expensive
|
||||||
|
// code see getTimeouts()
|
||||||
|
// after 3 rtt delay, we trigger timeout
|
||||||
|
const auto now_adjusted = getTimeNow() - getCurrentDelay()*3.f;
|
||||||
|
|
||||||
|
for (const auto& [seq, time_stamp, size, _] : _in_flight) {
|
||||||
|
if (now_adjusted > time_stamp) {
|
||||||
|
//list.push_back(seq);
|
||||||
|
size_timedout += size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_in_flight_bytes_accounted = _in_flight_bytes - size_timedout;
|
||||||
|
}
|
||||||
|
|
||||||
void FlowOnly::updateCongestion(void) {
|
void FlowOnly::updateCongestion(void) {
|
||||||
updateWindow();
|
updateWindow();
|
||||||
const auto tmp_window = getWindow();
|
const auto tmp_window = getWindow();
|
||||||
@ -70,8 +89,10 @@ int64_t FlowOnly::canSend(float time_delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateWindow();
|
updateWindow();
|
||||||
|
updateAccounted();
|
||||||
|
|
||||||
int64_t fspace = _fwnd - _in_flight_bytes;
|
//int64_t fspace = _fwnd - _in_flight_bytes;
|
||||||
|
int64_t fspace = _fwnd - _in_flight_bytes_accounted;
|
||||||
if (fspace < MAXIMUM_SEGMENT_DATA_SIZE) {
|
if (fspace < MAXIMUM_SEGMENT_DATA_SIZE) {
|
||||||
return 0u;
|
return 0u;
|
||||||
}
|
}
|
||||||
@ -107,6 +128,10 @@ int64_t FlowOnly::inFlightBytes(void) const {
|
|||||||
return _in_flight_bytes;
|
return _in_flight_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t FlowOnly::inFlightBytesAccounted(void) const {
|
||||||
|
return _in_flight_bytes_accounted;
|
||||||
|
}
|
||||||
|
|
||||||
void FlowOnly::onSent(SeqIDType seq, size_t data_size) {
|
void FlowOnly::onSent(SeqIDType seq, size_t data_size) {
|
||||||
if constexpr (true) {
|
if constexpr (true) {
|
||||||
size_t sum {0u};
|
size_t sum {0u};
|
||||||
|
@ -32,6 +32,7 @@ struct FlowOnly : public CCAI {
|
|||||||
};
|
};
|
||||||
std::vector<FlyingBunch> _in_flight;
|
std::vector<FlyingBunch> _in_flight;
|
||||||
int64_t _in_flight_bytes {0};
|
int64_t _in_flight_bytes {0};
|
||||||
|
int64_t _in_flight_bytes_accounted {0};
|
||||||
|
|
||||||
int32_t _consecutive_events {0};
|
int32_t _consecutive_events {0};
|
||||||
|
|
||||||
@ -58,6 +59,8 @@ struct FlowOnly : public CCAI {
|
|||||||
|
|
||||||
void updateWindow(void);
|
void updateWindow(void);
|
||||||
|
|
||||||
|
void updateAccounted(void);
|
||||||
|
|
||||||
virtual void onCongestion(void) {};
|
virtual void onCongestion(void) {};
|
||||||
|
|
||||||
// internal logic, calls the onCongestion() event
|
// internal logic, calls the onCongestion() event
|
||||||
@ -77,6 +80,7 @@ struct FlowOnly : public CCAI {
|
|||||||
|
|
||||||
int64_t inFlightCount(void) const override;
|
int64_t inFlightCount(void) const override;
|
||||||
int64_t inFlightBytes(void) const override;
|
int64_t inFlightBytes(void) const override;
|
||||||
|
int64_t inFlightBytesAccounted(void) const override;
|
||||||
|
|
||||||
public: // callbacks
|
public: // callbacks
|
||||||
// data size is without overhead
|
// data size is without overhead
|
||||||
|
Loading…
Reference in New Issue
Block a user