@@ -113,12 +113,25 @@ impl NodeUdpPaths {
113
113
& self . best
114
114
}
115
115
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.
116
119
pub ( super ) fn update_to_best_addr ( & mut self , now : Instant ) {
117
120
self . best_ipv4 = self . best_addr ( false , now) ;
118
121
self . best = self . best_addr ( true , now) ;
119
122
}
120
123
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 {
122
135
let Some ( ( ipp, path) ) = self
123
136
. paths
124
137
. iter ( )
@@ -153,6 +166,10 @@ impl NodeUdpPaths {
153
166
}
154
167
}
155
168
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.
156
173
#[ derive( PartialEq , Eq ) ]
157
174
struct ReverseOrd < N : PartialOrd + Ord + PartialEq + Eq > ( N ) ;
158
175
0 commit comments