Skip to content

Commit 56b987e

Browse files
committed
fix: rename features to capabilities
1 parent 7add320 commit 56b987e

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/message.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,18 @@ impl DataHash {
9696
}
9797
}
9898

99-
/// Bitmask enum representing features supported by the server.
99+
/// Bitmask enum representing capabilities supported by the server.
100100
#[bitmask(u64)]
101101
#[bitmask_config(vec_debug)]
102-
pub enum ServerFeatures {
102+
pub enum Capabilities {
103103
/// Indicates support for preload checks.
104104
PreloadCheck = 0x1,
105105
}
106106

107107
/// Enum of messages sent from the client to the server.
108108
#[derive(Debug)]
109109
pub enum ClientMessage {
110-
/// Handshake message specifying supported protocol version range.
110+
/// Handshake message specifying the supported protocol version range.
111111
ClientHandshake { min_version: u8, max_version: u8 },
112112

113113
/// Authentication message including client ID, secret, and IP address.
@@ -308,10 +308,11 @@ pub enum ServerMessage {
308308
/// Error response message.
309309
Error(ErrorResponse),
310310

311-
/// Server handshake response with accepted protocol version and features.
311+
/// Server handshake response with the accepted protocol version and
312+
/// capabilities.
312313
ServerHandshake {
313314
accepted_version: u8,
314-
features: ServerFeatures,
315+
capabilities: Capabilities,
315316
},
316317

317318
/// Authentication was accepted.
@@ -349,11 +350,11 @@ impl From<ServerMessage> for Message {
349350
ServerMessage::Error(error) => Message::new(0x00, vec![error.into_error_code()]),
350351
ServerMessage::ServerHandshake {
351352
accepted_version,
352-
features,
353+
capabilities,
353354
} => {
354355
let mut payload = Vec::with_capacity(9);
355356
payload.push(accepted_version);
356-
payload.extend_from_slice(&features.bits().to_le_bytes());
357+
payload.extend_from_slice(&capabilities.bits().to_le_bytes());
357358
Message::new(0x02, payload)
358359
}
359360
ServerMessage::AuthenticationAccepted => Message::new(0x04, vec![]),
@@ -620,10 +621,10 @@ mod tests {
620621

621622
#[test]
622623
fn server_handshake_serializes_correctly() {
623-
let features = ServerFeatures::none();
624+
let features = Capabilities::none();
624625
let server_msg = ServerMessage::ServerHandshake {
625626
accepted_version: 7,
626-
features,
627+
capabilities: features,
627628
};
628629
let message: Message = server_msg.into();
629630
assert_eq!(message.message_type, 0x02);

src/network.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
66
use crate::engine::EngineRequest;
77
use crate::event::Event;
8-
use crate::message::{ClientMessage, ErrorResponse, Message, ServerFeatures, ServerMessage};
8+
use crate::message::{Capabilities, ClientMessage, ErrorResponse, Message, ServerMessage};
99
use argon2::{Argon2, PasswordVerifier, password_hash::PasswordHashString};
10+
#[cfg(feature = "tokio-graceful-shutdown")]
1011
use async_trait::async_trait;
1112
use rustls::ServerConfig;
1213
use rustls::pki_types::{
@@ -590,7 +591,7 @@ where
590591
writer,
591592
ServerMessage::ServerHandshake {
592593
accepted_version: 3,
593-
features: ServerFeatures::PreloadCheck,
594+
capabilities: Capabilities::PreloadCheck,
594595
},
595596
)
596597
.await?;
@@ -701,7 +702,7 @@ mod tests {
701702

702703
let server_handshake: Message = ServerMessage::ServerHandshake {
703704
accepted_version: 3,
704-
features: ServerFeatures::PreloadCheck,
705+
capabilities: Capabilities::PreloadCheck,
705706
}
706707
.into();
707708

@@ -734,7 +735,7 @@ mod tests {
734735

735736
let server_handshake: Message = ServerMessage::ServerHandshake {
736737
accepted_version: 3,
737-
features: ServerFeatures::PreloadCheck,
738+
capabilities: Capabilities::PreloadCheck,
738739
}
739740
.into();
740741

@@ -771,7 +772,7 @@ mod tests {
771772

772773
let server_handshake: Message = ServerMessage::ServerHandshake {
773774
accepted_version: 3,
774-
features: ServerFeatures::PreloadCheck,
775+
capabilities: Capabilities::PreloadCheck,
775776
}
776777
.into();
777778

0 commit comments

Comments
 (0)