clear receiving transfers

TODO: actually keep around for 2*delay, so missing packets can still be retransmitted
but this fixes perf issues
This commit is contained in:
Green Sky 2024-07-07 11:03:36 +02:00
parent d19fc6ba30
commit eaaf798661
No known key found for this signature in database

View File

@ -372,7 +372,7 @@ bool NGCFT1::onEvent(const Events::NGCEXT_ft1_init& e) {
auto& peer = groups[e.group_number].peers[e.peer_number]; auto& peer = groups[e.group_number].peers[e.peer_number];
if (peer.recv_transfers[e.transfer_id].has_value()) { if (peer.recv_transfers[e.transfer_id].has_value()) {
std::cerr << "NGCFT1 warning: overwriting existing recv_transfer " << int(e.transfer_id) << "\n"; std::cerr << "NGCFT1 warning: overwriting existing recv_transfer " << int(e.transfer_id) << ", other peer started new transfer on preexising\n";
} }
peer.recv_transfers[e.transfer_id] = Group::Peer::RecvTransfer{ peer.recv_transfers[e.transfer_id] = Group::Peer::RecvTransfer{
@ -502,6 +502,11 @@ bool NGCFT1::onEvent(const Events::NGCEXT_ft1_data& e) {
e.transfer_id e.transfer_id
} }
); );
// delete transfer
// TODO: keep around for remote timeout + delay + offset, so we can be sure all acks where received
// or implement a dedicated finished that needs to be acked
peer.recv_transfers[e.transfer_id].reset();
} }
return true; return true;