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