File tree Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 113
113
/// increase factor for the next timeout until next try
114
114
period_increase_factor : 2 ,
115
115
} ,
116
+ /// Interval in millisecond to check if the listening endpoints changed (i.e. when listening on 0.0.0.0 or [::]).
117
+ /// Also update the multicast scouting listening interfaces. Use -1 to disable.
118
+ endpoint_poll_interval_ms : 10000 ,
116
119
} ,
117
120
/// Configure the session open behavior.
118
121
open : {
Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ pub mod listen {
55
55
56
56
pub const timeout_ms: ModeDependentValue < i64 > = ModeDependentValue :: Unique ( 0 ) ;
57
57
pub const exit_on_failure: ModeDependentValue < bool > = ModeDependentValue :: Unique ( true ) ;
58
+
59
+ pub const endpoint_poll_interval_ms: Option < i64 > = Some ( 10_000 ) ;
58
60
}
59
61
60
62
#[ allow( non_upper_case_globals) ]
@@ -180,6 +182,7 @@ impl Default for ListenConfig {
180
182
peer : Some ( vec ! [ ] ) ,
181
183
client : None ,
182
184
} ) ,
185
+ endpoint_poll_interval_ms : Some ( 10_000 ) ,
183
186
exit_on_failure : None ,
184
187
retry : None ,
185
188
}
Original file line number Diff line number Diff line change @@ -384,6 +384,9 @@ validated_struct::validator! {
384
384
/// if connection timeout exceed, exit from application
385
385
pub exit_on_failure: Option <ModeDependentValue <bool >>,
386
386
pub retry: Option <connection_retry:: ConnectionRetryModeDependentConf >,
387
+ /// Interval in millisecond to check if the listening endpoints changed (e.g. when listening on 0.0.0.0).
388
+ /// Also update the multicast scouting listening interfaces. Use -1 to disable.
389
+ pub endpoint_poll_interval_ms: Option <i64 >,
387
390
} ,
388
391
/// Configure the session open behavior.
389
392
pub open: #[ derive( Default ) ]
Original file line number Diff line number Diff line change @@ -380,12 +380,21 @@ impl Runtime {
380
380
}
381
381
382
382
async fn monitor_available_addrs ( & self ) {
383
- let token = self . get_cancellation_token ( ) ;
384
- let update_interval = Duration :: from_secs ( 10 ) ;
385
- loop {
386
- tokio:: select! {
387
- _ = tokio:: time:: sleep( update_interval) => self . update_available_addrs( ) . await ,
388
- _ = token. cancelled( ) => return ,
383
+ let update_interval_ms = self
384
+ . config ( )
385
+ . lock ( )
386
+ . 0
387
+ . listen
388
+ . endpoint_poll_interval_ms ( )
389
+ . unwrap_or ( 10_000 ) ;
390
+ if update_interval_ms > 0 {
391
+ let update_interval = Duration :: from_millis ( update_interval_ms as u64 ) ;
392
+ let token = self . get_cancellation_token ( ) ;
393
+ loop {
394
+ tokio:: select! {
395
+ _ = tokio:: time:: sleep( update_interval) => self . update_available_addrs( ) . await ,
396
+ _ = token. cancelled( ) => return ,
397
+ }
389
398
}
390
399
}
391
400
}
You can’t perform that action at this time.
0 commit comments