This commit is contained in:
2025-08-16 07:54:55 +02:00
parent d3e28cafe4
commit 0f6e595000
17 changed files with 2351 additions and 71 deletions

View File

@@ -50,6 +50,9 @@ impl Server {
Cmd::from(s).unwrap_or((Cmd::Unknow, Protocol::err("unknow cmd")));
println!("got command: {:?}, protocol: {:?}", cmd, protocol);
// Check if this is a QUIT command before processing
let is_quit = matches!(cmd, Cmd::Quit);
let res = cmd
.run(self, protocol, &mut queued_cmd)
.await
@@ -58,6 +61,12 @@ impl Server {
println!("going to send response {}", res.encode());
_ = stream.write(res.encode().as_bytes()).await?;
// If this was a QUIT command, close the connection
if is_quit {
println!("[handle] QUIT command received, closing connection");
return Ok(());
}
} else {
println!("[handle] going to break");
break;