Skip to content

RUST-725 Use "hello" for handshake and heartbeat when an API version is declared #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use hello for versioned connections
  • Loading branch information
abr-egn committed Jun 28, 2021
commit d6f4f78d4d1c5c2fbf36ec984dbb9b830129670d
6 changes: 4 additions & 2 deletions src/is_master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use crate::{

/// Construct an isMaster command.
pub(crate) fn is_master_command(api: Option<&ServerApi>) -> Command {
let mut command = Command::new("isMaster".into(), "admin".into(), doc! { "isMaster": 1 });
let command_name = if api.is_some() { "hello" } else { "isMaster" };
let mut command = Command::new(command_name.into(), "admin".into(), doc! { command_name: 1 });
if let Some(server_api) = api {
command.set_server_api(server_api);
}
Expand All @@ -27,7 +28,8 @@ pub(crate) async fn run_is_master(
command: Command,
conn: &mut Connection,
) -> Result<IsMasterReply> {
if !command.name.eq_ignore_ascii_case("ismaster") {
if !command.name.eq_ignore_ascii_case("ismaster") &&
!command.name.eq_ignore_ascii_case("hello") {
return Err(ErrorKind::Internal {
message: format!("invalid ismaster command: {}", command.name),
}
Expand Down