Acknowledge client QUITs by sending an ERROR as defined in the spec
Diff
src/client.rs | 33 ++++++++++++++++++---------------
src/database/mod.rs | 5 ++++-
2 files changed, 19 insertions(+), 19 deletions(-)
@@ -129,7 +129,11 @@
self.server.do_send(ServerDisconnect {
client: ctx.address(),
message: message.clone(),
message: if self.graceful_shutdown {
Some(format!("Quit: {}", message.as_deref().unwrap_or("")))
} else {
message.clone()
},
span: Span::current(),
});
@@ -142,23 +146,16 @@
});
}
if self.graceful_shutdown {
self.writer.write(Message {
tags: None,
prefix: Some(self.connection.to_nick()),
command: Command::QUIT(message),
});
} else {
let message = message.unwrap_or_else(|| "Ungraceful shutdown".to_string());
self.writer.write(Message {
tags: None,
prefix: None,
command: Command::ERROR(message),
});
}
self.writer.write(Message {
tags: None,
prefix: None,
command: Command::ERROR(if self.graceful_shutdown {
String::new()
} else {
message.unwrap_or_else(|| "Ungraceful shutdown".to_string())
}),
});
}
}
@@ -48,6 +48,9 @@
}
pub fn verify_password(password: &[u8], hash: &PasswordHash<'_>) -> argon2::password_hash::Result<()> {
pub fn verify_password(
password: &[u8],
hash: &PasswordHash<'_>,
) -> argon2::password_hash::Result<()> {
Argon2::default().verify_password(password, hash)
}