make onLoss return if found
This commit is contained in:
@@ -69,7 +69,8 @@ struct CCAI {
|
||||
virtual void onAck(std::vector<SeqIDType> seqs) = 0;
|
||||
|
||||
// if discard, not resent, not inflight
|
||||
virtual void onLoss(SeqIDType seq, bool discard) = 0;
|
||||
// return if found
|
||||
virtual bool onLoss(SeqIDType seq, bool discard) = 0;
|
||||
|
||||
// signal congestion externally (eg. send queue is full)
|
||||
virtual void onCongestion(void) {};
|
||||
|
||||
@@ -211,15 +211,18 @@ void FlowOnly::onAck(std::vector<SeqIDType> seqs) {
|
||||
}
|
||||
}
|
||||
|
||||
void FlowOnly::onLoss(SeqIDType seq, bool discard) {
|
||||
bool FlowOnly::onLoss(SeqIDType seq, bool discard) {
|
||||
auto it = std::find_if(_in_flight.begin(), _in_flight.end(), [seq](const auto& v) -> bool {
|
||||
assert(!std::isnan(v.timestamp));
|
||||
return v.id == seq;
|
||||
});
|
||||
|
||||
// we care about it still being there, when we do not discard
|
||||
if (it == _in_flight.end()) {
|
||||
// error
|
||||
return; // not found, ignore ??
|
||||
if (!discard) {
|
||||
std::cerr << "FLOW seq not found!\n";
|
||||
}
|
||||
return false; // not found, ignore ??
|
||||
}
|
||||
|
||||
//std::cerr << "FLOW loss\n";
|
||||
@@ -249,5 +252,7 @@ void FlowOnly::onLoss(SeqIDType seq, bool discard) {
|
||||
// this is usually a safe indicator for congestion/maxed connection
|
||||
onCongestion();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,6 @@ struct FlowOnly : public CCAI {
|
||||
void onAck(std::vector<SeqIDType> seqs) override;
|
||||
|
||||
// if discard, not resent, not inflight
|
||||
void onLoss(SeqIDType seq, bool discard) override;
|
||||
bool onLoss(SeqIDType seq, bool discard) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ void LEDBAT::onAck(std::vector<SeqIDType> seqs) {
|
||||
updateWindows();
|
||||
}
|
||||
|
||||
void LEDBAT::onLoss(SeqIDType seq, bool discard) {
|
||||
bool LEDBAT::onLoss(SeqIDType seq, bool discard) {
|
||||
auto it = std::find_if(_in_flight.begin(), _in_flight.end(), [seq](const auto& v) -> bool {
|
||||
assert(!std::isnan(std::get<1>(v)));
|
||||
return std::get<0>(v) == seq;
|
||||
@@ -139,7 +139,7 @@ void LEDBAT::onLoss(SeqIDType seq, bool discard) {
|
||||
|
||||
if (it == _in_flight.end()) {
|
||||
// error
|
||||
return; // not found, ignore ??
|
||||
return false; // not found, ignore ??
|
||||
}
|
||||
|
||||
if (PLOTTING) {
|
||||
@@ -165,6 +165,8 @@ void LEDBAT::onLoss(SeqIDType seq, bool discard) {
|
||||
#endif
|
||||
|
||||
updateWindows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
float LEDBAT::getCurrentDelay(void) const {
|
||||
|
||||
@@ -72,7 +72,7 @@ struct LEDBAT : public CCAI {
|
||||
void onAck(std::vector<SeqIDType> seqs) override;
|
||||
|
||||
// if discard, not resent, not inflight
|
||||
void onLoss(SeqIDType seq, bool discard) override;
|
||||
bool onLoss(SeqIDType seq, bool discard) override;
|
||||
|
||||
private:
|
||||
using clock = std::chrono::steady_clock;
|
||||
|
||||
Reference in New Issue
Block a user