@@ -523,6 +523,7 @@ static tx_frame_t* tx_frame_new(udpard_tx_t* const tx, const udpard_mem_resource
523523 frame -> size = data_size ;
524524 // Update the count; this is decremented when the frame is freed upon refcount reaching zero.
525525 tx -> enqueued_frames_count ++ ;
526+ UDPARD_ASSERT (tx -> enqueued_frames_count <= tx -> enqueued_frames_limit );
526527 }
527528 return frame ;
528529}
@@ -1004,20 +1005,17 @@ static void tx_promote_staged(udpard_tx_t* const self, const udpard_us_t now)
10041005 tx_transfer_t * const tr = CAVL2_TO_OWNER (cavl2_min (self -> index_staged ), tx_transfer_t , index_staged );
10051006 if ((tr != NULL ) && (now >= tr -> staged_until )) {
10061007 UDPARD_ASSERT (tr -> cursor != NULL ); // cannot stage without payload, doesn't make sense
1007-
10081008 // Reinsert into the staged index at the new position, when the next attempt is due.
10091009 // Do not insert if this is the last attempt -- no point doing that since it will not be transmitted again.
10101010 cavl2_remove (& self -> index_staged , & tr -> index_staged );
1011- tr -> epoch ++ ;
1012- tr -> staged_until += tx_ack_timeout (self -> ack_baseline_timeout , tr -> priority , tr -> epoch );
1011+ tr -> staged_until += tx_ack_timeout (self -> ack_baseline_timeout , tr -> priority , ++ (tr -> epoch ));
10131012 if (tr -> deadline > tr -> staged_until ) {
10141013 (void )cavl2_find_or_insert (& self -> index_staged ,
10151014 & tr -> staged_until ,
10161015 tx_cavl_compare_staged ,
10171016 & tr -> index_staged ,
10181017 cavl2_trivial_factory );
10191018 }
1020-
10211019 // Enqueue for transmission unless it's been there since the last attempt (stalled interface?)
10221020 for (uint_fast8_t i = 0 ; i < UDPARD_IFACE_COUNT_MAX ; i ++ ) {
10231021 UDPARD_ASSERT (tr -> cursor [i ] == tr -> head [i ]);
@@ -1047,7 +1045,6 @@ static void tx_eject_pending(udpard_tx_t* const self, const udpard_us_t now, con
10471045 if (tr == NULL ) {
10481046 break ; // No pending transfers at the moment. Find something else to do.
10491047 }
1050- UDPARD_ASSERT (!cavl2_is_inserted (self -> index_staged , & tr -> index_staged ));
10511048 UDPARD_ASSERT (tr -> cursor != NULL ); // cannot be pending without payload, doesn't make sense
10521049
10531050 // Eject the frame.
0 commit comments