@@ -890,9 +890,11 @@ static uint32_t tx_push(udpard_tx_t* const tx,
890890 (void )cavl2_find_or_insert (
891891 & tx -> index_deadline , & tr -> deadline , tx_cavl_compare_deadline , & tr -> index_deadline , cavl2_trivial_factory );
892892 // Add to the transfer index for incoming ack management.
893- const tx_transfer_key_t key = { .topic_hash = tr -> topic_hash , .transfer_id = tr -> transfer_id };
894- ( void ) cavl2_find_or_insert (
893+ const tx_transfer_key_t key = { .topic_hash = tr -> topic_hash , .transfer_id = tr -> transfer_id };
894+ const udpard_tree_t * const tree_transfer = cavl2_find_or_insert (
895895 & tx -> index_transfer , & key , tx_cavl_compare_transfer , & tr -> index_transfer , cavl2_trivial_factory );
896+ UDPARD_ASSERT (tree_transfer == & tr -> index_transfer ); // ensure no duplicates; checked at the API level
897+ (void )tree_transfer ;
896898 // Add to the agewise list to allow instant sacrifice when needed; oldest at the tail.
897899 enlist_head (& tx -> agewise , & tr -> agewise );
898900
@@ -1039,23 +1041,38 @@ uint32_t udpard_tx_push(udpard_tx_t* const self,
10391041 // Before attempting to enqueue a new transfer, we need to update the transmission scheduler.
10401042 // It may release some items from the tx queue, and it may also promote some staged transfers to the queue.
10411043 udpard_tx_poll (self , now , UDPARD_IFACE_MASK_ALL );
1042- const meta_t meta = {
1043- .priority = priority ,
1044- .flag_ack = feedback != NULL ,
1045- .transfer_payload_size = (uint32_t )payload .size ,
1046- .transfer_id = transfer_id ,
1047- .sender_uid = self -> local_uid ,
1048- .topic_hash = topic_hash ,
1049- };
1050- out = tx_push (self , //
1051- now ,
1052- deadline ,
1053- meta ,
1054- remote_ep ,
1055- payload ,
1056- feedback ,
1057- user_transfer_reference ,
1058- NULL );
1044+ const meta_t meta = { .priority = priority ,
1045+ .flag_ack = feedback != NULL ,
1046+ .transfer_payload_size = (uint32_t )payload .size ,
1047+ .transfer_id = transfer_id ,
1048+ .sender_uid = self -> local_uid ,
1049+ .topic_hash = topic_hash };
1050+ out = tx_push (self , now , deadline , meta , remote_ep , payload , feedback , user_transfer_reference , NULL );
1051+ }
1052+ return out ;
1053+ }
1054+
1055+ uint32_t udpard_tx_push_p2p (udpard_tx_t * const self ,
1056+ const udpard_us_t now ,
1057+ const udpard_us_t deadline ,
1058+ const udpard_prio_t priority ,
1059+ const udpard_remote_t remote ,
1060+ const udpard_bytes_t payload ,
1061+ void (* const feedback )(udpard_tx_t * , udpard_tx_feedback_t ),
1062+ void * const user_transfer_reference )
1063+ {
1064+ uint32_t out = 0 ;
1065+ if (self != NULL ) {
1066+ out = udpard_tx_push (self ,
1067+ now ,
1068+ deadline ,
1069+ priority ,
1070+ remote .uid ,
1071+ remote .endpoints ,
1072+ self -> p2p_transfer_id ++ ,
1073+ payload ,
1074+ feedback ,
1075+ user_transfer_reference );
10591076 }
10601077 return out ;
10611078}
0 commit comments