rwhod: allow configuring packet send interval

This commit is contained in:
2026-07-20 21:52:34 +09:00
parent c0c0e47c8a
commit 536b0c4b54
4 changed files with 34 additions and 2 deletions
+5
View File
@@ -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)]
+2 -1
View File
@@ -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;