aboutsummaryrefslogtreecommitdiff
path: root/server/src/main.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-29 20:26:02 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-29 20:26:02 +0200
commit04a4902d1054a2e8776107c99ef83496b6050b60 (patch)
tree45d4bd14ec4a17e0accd060bf7211ee421418a34 /server/src/main.rs
parent03c46a18d3a283ee737688c4c65bb5ef1d6ba1dc (diff)
downloadhurrycurry-04a4902d1054a2e8776107c99ef83496b6050b60.tar
hurrycurry-04a4902d1054a2e8776107c99ef83496b6050b60.tar.bz2
hurrycurry-04a4902d1054a2e8776107c99ef83496b6050b60.tar.zst
server message for command errors
Diffstat (limited to 'server/src/main.rs')
-rw-r--r--server/src/main.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index bf69f295..68927eaa 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -151,13 +151,17 @@ async fn run() -> anyhow::Result<()> {
}
};
debug!("<- {id:?} {packet:?}");
- if let Err(e) = state.write().await.packet_in(id, packet).await {
- warn!("client error: {e}");
- let _ = error_tx
- .send(PacketC::Error {
+ let packet_out = match state.write().await.packet_in(id, packet).await {
+ Ok(packets) => packets,
+ Err(e) => {
+ warn!("client error: {e}");
+ vec![PacketC::Error {
message: format!("{e}"),
- })
- .await;
+ }]
+ }
+ };
+ for packet in packet_out {
+ let _ = error_tx.send(packet).await;
}
}
Message::Close(_) => break,