Commit d79d548 1 parent 82cc875 commit d79d548 Copy full SHA for d79d548
File tree 2 files changed +13
-9
lines changed
2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ pub struct RandomConnectionIdGenerator {
26
26
cid_len : usize ,
27
27
lifetime : Option < Duration > ,
28
28
}
29
+
29
30
impl Default for RandomConnectionIdGenerator {
30
31
fn default ( ) -> Self {
31
32
Self {
@@ -34,8 +35,11 @@ impl Default for RandomConnectionIdGenerator {
34
35
}
35
36
}
36
37
}
38
+
37
39
impl RandomConnectionIdGenerator {
38
- /// Initialize Random CID generator with a fixed CID length (which must be less or equal to MAX_CID_SIZE)
40
+ /// Initialize Random CID generator with a fixed CID length
41
+ ///
42
+ /// The given length must be less than or equal to MAX_CID_SIZE.
39
43
pub fn new ( cid_len : usize ) -> Self {
40
44
debug_assert ! ( cid_len <= MAX_CID_SIZE ) ;
41
45
Self {
@@ -50,6 +54,7 @@ impl RandomConnectionIdGenerator {
50
54
self
51
55
}
52
56
}
57
+
53
58
impl ConnectionIdGenerator for RandomConnectionIdGenerator {
54
59
fn generate_cid ( & mut self ) -> ( ConnectionId , Option < Duration > ) {
55
60
let mut bytes_arr = [ 0 ; MAX_CID_SIZE ] ;
Original file line number Diff line number Diff line change @@ -324,15 +324,14 @@ where
324
324
325
325
/// Supply a custom connection ID generator factory
326
326
///
327
- /// Called once by each `Endpoint` constructed from this configuration to obtain the CID generator which will
328
- /// be used to generate the CIDs used for incoming packets on all connections involving that `Endpoint`. A
329
- /// custom CID generator allows applications to embed information in local connection IDs, e.g. to support
330
- /// stateless packet-level load balancers.
327
+ /// Called once by each `Endpoint` constructed from this configuration to obtain the CID
328
+ /// generator which will be used to generate the CIDs used for incoming packets on all
329
+ /// connections involving that `Endpoint`. A custom CID generator allows applications to embed
330
+ /// information in local connection IDs, e.g. to support stateless packet-level load balancers.
331
331
///
332
- ///
333
- /// EndpointConfig::new() applies a default random CID generator factory.
334
- /// This functions accepts any customized CID generator to reset CID generator factory that
335
- /// implements ConnectionIdGenerator trait
332
+ /// `EndpointConfig::new()` applies a default random CID generator factory. This functions
333
+ /// accepts any customized CID generator to reset CID generator factory that implements
334
+ /// the `ConnectionIdGenerator` trait.
336
335
pub fn cid_generator < F : Fn ( ) -> Box < dyn ConnectionIdGenerator > + Send + Sync + ' static > (
337
336
& mut self ,
338
337
factory : F ,
You can’t perform that action at this time.
0 commit comments