From e9f9e21bc20f79d203618a8e49c077b7069c350a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=AA=E3=82=AD=E8=90=8C?= Date: Fri, 5 Sep 2025 20:20:45 +0200 Subject: [PATCH] make the server not send chunks redundantly when there aren't any to send --- crates/rkgk/src/api/wall.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/rkgk/src/api/wall.rs b/crates/rkgk/src/api/wall.rs index ab13378..d069911 100644 --- a/crates/rkgk/src/api/wall.rs +++ b/crates/rkgk/src/api/wall.rs @@ -429,13 +429,15 @@ impl SessionLoop { } } - ws.send(to_message(&Notify::Chunks { - chunks: chunk_infos, - has_more: !self.pending_images.is_empty() - || self.viewport_chunks.clone().next().is_some(), - })) - .await?; - ws.send(Message::Binary(packet)).await?; + if !chunk_infos.is_empty() { + ws.send(to_message(&Notify::Chunks { + chunks: chunk_infos, + has_more: !self.pending_images.is_empty() + || self.viewport_chunks.clone().next().is_some(), + })) + .await?; + ws.send(Message::Binary(packet)).await?; + } Ok(()) }