rwhod: allow configuring packet send interval
This commit is contained in:
@@ -43,6 +43,11 @@ pub struct RwhodConfig {
|
||||
///
|
||||
/// If left as `None`, the server will send on all relevant interfaces it can find.
|
||||
pub interfaces: Option<HashSet<String>>,
|
||||
|
||||
/// Interval between rwhod status packet broadcasts.
|
||||
///
|
||||
/// If left as `None`, defaults to 60 seconds.
|
||||
pub send_interval_seconds: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
||||
@@ -114,8 +114,9 @@ pub async fn rwhod_packet_sender_task(
|
||||
socket: Arc<UdpSocket>,
|
||||
interfaces: Vec<RwhodSendTarget>,
|
||||
ignore_list: Option<IgnoreList>,
|
||||
send_interval: TokioDuration,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut interval = interval(TokioDuration::from_secs(60));
|
||||
let mut interval = interval(send_interval);
|
||||
|
||||
loop {
|
||||
interval.tick().await;
|
||||
|
||||
Reference in New Issue
Block a user