@@ -113,12 +113,25 @@ impl NodeUdpPaths {
113113 & self . best
114114 }
115115
116+ /// Change the current best address(es) to ones chosen as described in [`Self::best_addr`] docs.
117+ ///
118+ /// This should be called any time that `paths` is modified.
116119 pub ( super ) fn update_to_best_addr ( & mut self , now : Instant ) {
117120 self . best_ipv4 = self . best_addr ( false , now) ;
118121 self . best = self . best_addr ( true , now) ;
119122 }
120123
121- pub ( super ) fn best_addr ( & self , have_ipv6 : bool , now : Instant ) -> UdpSendAddr {
124+ /// Returns the current best address of all available paths, ignoring
125+ /// the currently chosen best address.
126+ ///
127+ /// We try to find the lowest latency [`UdpSendAddr::Valid`], if one exists, otherwise
128+ /// we try to find the lowest latency [`UdpSendAddr::Outdated`], if one exists, otherwise
129+ /// we return essentially an arbitrary [`UdpSendAddr::Unconfirmed`].
130+ ///
131+ /// If we don't have any addresses, returns [`UdpSendAddr::None`].
132+ ///
133+ /// If `have_ipv6` is false, we only search among ipv4 candidates.
134+ fn best_addr ( & self , have_ipv6 : bool , now : Instant ) -> UdpSendAddr {
122135 let Some ( ( ipp, path) ) = self
123136 . paths
124137 . iter ( )
@@ -153,6 +166,10 @@ impl NodeUdpPaths {
153166 }
154167}
155168
169+ /// Implements the reverse [`Ord`] implementation for the wrapped type.
170+ ///
171+ /// Literally calls [`std::cmp::Ordering::reverse`] on the inner value's
172+ /// ordering.
156173#[ derive( PartialEq , Eq ) ]
157174struct ReverseOrd < N : PartialOrd + Ord + PartialEq + Eq > ( N ) ;
158175
0 commit comments