Skip to content

Commit 53348b4

Browse files
committed
Don't panic when receiving acks from disconnected clients
Backends might not discard messages immediately, allowing to react to them.
1 parent 72e07c6 commit 53348b4

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Don't panic when receiving acks from disconnected clients (backends might not discard messages immediately, allowing to react to them).
13+
1014
## [0.39.4] - 2026-04-08
1115

1216
### Fixed

src/server.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,13 @@ fn receive_acks(
351351
mut clients: Query<&mut ClientTicks>,
352352
) {
353353
for (client, mut message) in messages.receive(ClientChannel::MutationAcks) {
354+
let Ok(mut ticks) = clients.get_mut(client) else {
355+
debug!("ignoring acks for disconnected client `{client}`");
356+
continue;
357+
};
354358
while message.has_remaining() {
355359
match postcard_utils::from_buf(&mut message) {
356360
Ok(mutate_index) => {
357-
let mut ticks = clients.get_mut(client).unwrap_or_else(|_| {
358-
panic!(
359-
"messages from client `{client}` should have been removed on disconnect"
360-
)
361-
});
362361
if let Some(entities) = ticks.ack_mutate_message(client, mutate_index) {
363362
pools.recycle_entities(entities);
364363
}

0 commit comments

Comments
 (0)