Skip to content

Commit

Permalink
Set peer last poll interval
Browse files Browse the repository at this point in the history
  • Loading branch information
rnijveld authored and cikzh committed Oct 5, 2023
1 parent d170da1 commit c2b62a0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ntp-proto/src/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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);
}
}

0 comments on commit c2b62a0

Please sign in to comment.