From c2b62a08a4b555e381636c27e00f7f08f535023e Mon Sep 17 00:00:00 2001 From: Ruben Nijveld Date: Thu, 5 Oct 2023 09:29:54 +0200 Subject: [PATCH] Set peer last poll interval --- ntp-proto/src/peer.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ntp-proto/src/peer.rs b/ntp-proto/src/peer.rs index 4ce76157d..c89f89d85 100644 --- a/ntp-proto/src/peer.rs +++ b/ntp-proto/src/peer.rs @@ -397,6 +397,9 @@ impl Peer { let used = cursor.position(); let result = &cursor.into_inner()[..used as usize]; + // update the poll interval + self.last_poll_interval = poll_interval; + Ok(result) } @@ -993,7 +996,6 @@ mod test { Err(IgnoreReason::KissDemobilize) )); - let old_poll_interval = peer.last_poll_interval; let old_remote_interval = peer.remote_min_poll_interval; let mut packet = NtpPacket::test(); let system = SystemSnapshot::default(); @@ -1008,10 +1010,8 @@ mod test { NtpTimestamp::from_fixed_int(100) ) .is_err()); - assert_eq!(peer.remote_min_poll_interval, old_poll_interval); assert_eq!(peer.remote_min_poll_interval, old_remote_interval); - let old_poll_interval = peer.last_poll_interval; let old_remote_interval = peer.remote_min_poll_interval; let mut packet = NtpPacket::test(); let system = SystemSnapshot::default(); @@ -1032,7 +1032,6 @@ mod test { NtpTimestamp::from_fixed_int(100) ) .is_err()); - assert!(peer.remote_min_poll_interval > old_poll_interval); assert!(peer.remote_min_poll_interval >= old_remote_interval); } }