@@ -825,7 +825,14 @@ CANARD_PRIVATE int8_t rxSessionUpdate(CanardInstance* const ins,
825
825
CANARD_ASSERT (frame -> transfer_id <= CANARD_TRANSFER_ID_MAX );
826
826
827
827
// The transfer ID timeout is measured relative to the timestamp of the last start-of-transfer frame.
828
+ // Triggering a TID timeout when the TID is the same is undesirable because it may cause the reassembler to
829
+ // switch to another interface if the start-of-transfer frame of the current transfer is duplicated
830
+ // on the other interface more than (transfer-ID timeout) units of time after the start of
831
+ // the transfer while the reassembly of this transfer is still in progress.
832
+ // While this behavior is not visible to the application because the transfer will still be reassembled,
833
+ // it may delay the delivery of the transfer.
828
834
const bool tid_timed_out = (frame -> timestamp_usec > rxs -> transfer_timestamp_usec ) &&
835
+ (frame -> transfer_id != rxs -> transfer_id ) &&
829
836
((frame -> timestamp_usec - rxs -> transfer_timestamp_usec ) > transfer_id_timeout_usec );
830
837
// Examples: rxComputeTransferIDDifference(2, 3)==31
831
838
// rxComputeTransferIDDifference(2, 2)==0
@@ -836,12 +843,6 @@ CANARD_PRIVATE int8_t rxSessionUpdate(CanardInstance* const ins,
836
843
const bool need_restart =
837
844
frame -> start_of_transfer &&
838
845
(tid_timed_out || ((rxs -> redundant_transport_index == redundant_transport_index ) && not_previous_tid ));
839
- // One interesting trait of this implementation is that if the start-of-transfer frame of the current
840
- // transfer is duplicated on another interface more than (transfer-ID timeout) units of time after the start of
841
- // the transfer while the reassembly of this transfer is still in progress,
842
- // the reassembler will switch to the other interface and restart the transfer reassembly from scratch.
843
- // This effect is not visible to the application because the outcome is the same as if the transfer was
844
- // received on the original interface.
845
846
if (need_restart )
846
847
{
847
848
CANARD_ASSERT (frame -> start_of_transfer );
0 commit comments