Skip to content

Commit fd07405

Browse files
nits
1 parent b7552e2 commit fd07405

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

libudpard/udpard.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,14 +1523,18 @@ static void rx_session_update(rx_session_t* const self,
15231523
(ordered ? rx_session_update_ordered : rx_session_update_unordered)(self, rx, ts, frame, payload_deleter);
15241524
}
15251525

1526+
// --------------------------------------------- RX PORT ---------------------------------------------
1527+
1528+
// TODO
1529+
1530+
// --------------------------------------------- RX PUBLIC API ---------------------------------------------
1531+
15261532
static bool rx_validate_memory_resources(const udpard_rx_memory_resources_t memory)
15271533
{
15281534
return (memory.session.alloc != NULL) && (memory.session.free != NULL) && //
15291535
(memory.fragment.alloc != NULL) && (memory.fragment.free != NULL);
15301536
}
15311537

1532-
// --------------------------------------------- RX PUBLIC API ---------------------------------------------
1533-
15341538
bool udpard_rx_new(udpard_rx_t* const self,
15351539
const uint64_t local_uid,
15361540
const udpard_rx_memory_resources_t p2p_port_memory,

libudpard/udpard.h

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,16 @@ typedef struct udpard_rx_memory_resources_t
504504
udpard_mem_resource_t fragment;
505505
} udpard_rx_memory_resources_t;
506506

507-
/// The transfer reassembly state machine can operate in several modes described below.
507+
/// The transfer reassembly state machine can operate in several modes described below. First, a brief summary:
508+
///
509+
/// Mode Guarantees Limitations Reordering window setting
510+
/// -----------------------------------------−-------------------------------------------------------------------------
511+
/// ORDERED Strictly increasing transfer-ID May delay transfers Non-negative number of microseconds
512+
/// UNORDERED Unique transfer-ID Ordering not guaranteed UDPARD_REORDERING_WINDOW_UNORDERED
513+
/// STATELESS Constant time, constant memory Single-frame only, duplicates UDPARD_REORDERING_WINDOW_STATELESS
514+
///
515+
/// If not sure, choose the ORDERED mode with a ~5 ms reordering window for all topics except for request-response
516+
/// RPC-style, in which case choose UNORDERED. The STATELESS mode is chiefly intended just for the heartbeat topic.
508517
///
509518
/// ORDERED
510519
///
@@ -751,27 +760,25 @@ void udpard_rx_subscription_free(udpard_rx_subscription_t* const self);
751760
///
752761
/// The function takes ownership of the passed datagram payload buffer. The library will either store it as a
753762
/// fragment of the reassembled transfer payload or free it using the corresponding memory resource
754-
/// (see UdpardRxMemoryResources) if the datagram is not needed for reassembly. Because of the ownership transfer,
755-
/// the datagram payload buffer has to be mutable (non-const).
756-
/// One exception is that if the "self" pointer is invalid, the library will be unable to process or free the datagram,
757-
/// which may lead to a memory leak in the application; hence, the caller should always check that the "self" pointer
758-
/// is always valid.
763+
/// (see udpard_rx_memory_resources_t) if the datagram is not needed for reassembly. Because of the ownership transfer,
764+
/// the datagram payload buffer has to be mutable (non-const). The ownership transfer does not take place if
765+
/// any of the arguments are invalid; the function returns false in that case and the caller must clean up.
759766
///
760-
/// The function invokes the dynamic memory manager in the following cases only (refer to UdpardRxPort for details):
767+
/// The function invokes the dynamic memory manager in the following cases only (refer to udpard_rx_port_t):
761768
///
762769
/// 1. A new session state instance is allocated when a new session is initiated.
763770
///
764771
/// 2. A new transfer fragment handle is allocated when a new transfer fragment is accepted.
765772
///
766-
/// 3. A new return path discovery instance is allocated when a new remote UID is observed.
767-
///
768-
/// 4. Allocated objects may occasionally be deallocated at the discretion of the library.
769-
/// This behavior does not increase the worst case execution time and does not improve the worst case memory
770-
/// consumption, so a deterministic application need not consider this behavior in its resource analysis.
771-
/// This behavior is implemented for the benefit of applications where rigorous characterization is unnecessary.
773+
/// 3. Allocated objects may occasionally be deallocated to clean up stale transfers and sessions when publishers
774+
/// disappear. This behavior does not increase the worst case execution time and does not improve the worst
775+
/// case memory consumption, so a deterministic application need not consider this behavior in its resource
776+
/// analysis. This behavior is implemented for the benefit of applications where rigorous characterization is
777+
/// unnecessary.
772778
///
773-
/// The time complexity is O(log n) where n is the number of remote notes publishing on this subject (topic).
774-
/// No data copy takes place. Malformed frames are discarded in constant time.
779+
/// The time complexity is O(log n + log k) where n is the number of remote notes publishing on this subject (topic),
780+
/// and k is the number of fragments retained in memory for the corresponding in-progress transfer.
781+
/// No data copying takes place.
775782
///
776783
/// Returns true on successful processing, false if any of the arguments are invalid.
777784
bool udpard_rx_subscription_receive(udpard_rx_t* const rx,

0 commit comments

Comments
 (0)