Skip to content

Commit

Permalink
fixup! Add a state machine for protocol upgrades to the peer
Browse files Browse the repository at this point in the history
  • Loading branch information
tdittr committed Oct 31, 2023
1 parent 4a2bc7d commit 6598597
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions ntp-proto/src/packet/extension_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ impl<'a> ExtensionField<'a> {

fn decode(
raw: RawExtensionField<'a>,
#[cfg_attr(not(feature = "ntpv5"), allow(unused_variables))]
extension_header_version: ExtensionHeaderVersion,
) -> Result<Self, ParsingError<std::convert::Infallible>> {
type EF<'a> = ExtensionField<'a>;
Expand Down
5 changes: 4 additions & 1 deletion ntp-proto/src/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ pub enum ProtocolVersion {
impl ProtocolVersion {
pub fn expected_incoming_version(&self) -> u8 {
match self {
ProtocolVersion::V4 | ProtocolVersion::V4UpgradingToV5 { .. } => 4,
ProtocolVersion::V4 => 4,
#[cfg(feature = "ntpv5")]
ProtocolVersion::V4UpgradingToV5 { .. } => 4,
#[cfg(feature = "ntpv5")]
ProtocolVersion::V5 => 5,
}
}
Expand Down

0 comments on commit 6598597

Please sign in to comment.