small refactor and print in flight packages when timing out

This commit is contained in:
Green Sky 2024-05-31 17:03:22 +02:00
parent c52ac19285
commit 0eb30246a8
No known key found for this signature in database
4 changed files with 14 additions and 6 deletions

View File

@ -64,6 +64,8 @@ struct CCAI {
// get the list of timed out seq_ids
virtual std::vector<SeqIDType> getTimeouts(void) const = 0;
virtual int64_t inFlightCount(void) const { return -1; }
public: // callbacks
// data size is without overhead
virtual void onSent(SeqIDType seq, size_t data_size) = 0;

View File

@ -98,6 +98,10 @@ std::vector<FlowOnly::SeqIDType> FlowOnly::getTimeouts(void) const {
return list;
}
int64_t FlowOnly::inFlightCount(void) const {
return _in_flight.size();
}
void FlowOnly::onSent(SeqIDType seq, size_t data_size) {
if constexpr (true) {
for (const auto& it : _in_flight) {
@ -105,15 +109,15 @@ void FlowOnly::onSent(SeqIDType seq, size_t data_size) {
}
}
_in_flight.push_back(
const auto& new_entry = _in_flight.emplace_back(
FlyingBunch{
seq,
static_cast<float>(getTimeNow()),
data_size + SEGMENT_OVERHEAD
data_size + SEGMENT_OVERHEAD,
false
}
);
_in_flight_bytes += data_size + SEGMENT_OVERHEAD;
//_recently_sent_bytes += data_size + SEGMENT_OVERHEAD;
_in_flight_bytes += new_entry.bytes;
_time_point_last_update = getTimeNow();
}

View File

@ -75,6 +75,8 @@ struct FlowOnly : public CCAI {
// get the list of timed out seq_ids
std::vector<SeqIDType> getTimeouts(void) const override;
int64_t inFlightCount(void) const override;
public: // callbacks
// data size is without overhead
void onSent(SeqIDType seq, size_t data_size) override;

View File

@ -217,7 +217,7 @@ void NGCFT1::updateSendTransfer(float time_delta, uint32_t group_number, uint32_
// timeout increases with active transfers (otherwise we could starve them)
if (tf.time_since_activity >= (sending_give_up_after * peer.active_send_transfers)) {
// no ack after 30sec, close ft
std::cerr << "NGCFT1 warning: sending ft in progress timed out, deleting\n";
std::cerr << "NGCFT1 warning: sending ft in progress timed out, deleting (ifc:" << peer.cca->inFlightCount() << ")\n";
dispatch(
NGCFT1_Event::send_done,
Events::NGCFT1_send_done{
@ -316,7 +316,7 @@ void NGCFT1::iteratePeer(float time_delta, uint32_t group_number, uint32_t peer_
}
}
// change iterat start position to not starve transfers in the back
// change iterate start position to not starve transfers in the back
size_t iterated_count = 0;
bool last_send_found = false;
for (size_t idx = peer.next_send_transfer_send_idx; iterated_count < peer.send_transfers.size(); idx++, iterated_count++) {