From 46900554c3d3e0f97c5ae53e540e32d0dffa09d5 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 18 Apr 2024 14:52:05 +0700 Subject: [PATCH] Don't flush when writing universe time packet --- .../kotlin/ru/dbotthepony/kstarbound/server/ServerChannels.kt | 4 ++-- .../ru/dbotthepony/kstarbound/server/StarboundServer.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerChannels.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerChannels.kt index 5cc91dcd..68263760 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerChannels.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerChannels.kt @@ -87,10 +87,10 @@ class ServerChannels(val server: StarboundServer) : Closeable { } } - fun broadcast(packet: IPacket) { + fun broadcast(packet: IPacket, flush: Boolean = true) { connections.forEach { if (it.isReady) { - it.send(packet) + it.send(packet, flush) } } } diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/server/StarboundServer.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/server/StarboundServer.kt index e4a38a6d..8701f9af 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/server/StarboundServer.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/server/StarboundServer.kt @@ -187,7 +187,7 @@ sealed class StarboundServer(val root: File) : BlockableEventLoop("Server thread init { scheduleAtFixedRate(Runnable { - channels.broadcast(UniverseTimeUpdatePacket(universeClock.time)) + channels.broadcast(UniverseTimeUpdatePacket(universeClock.time), false) }, Globals.universeServer.clockUpdatePacketInterval, Globals.universeServer.clockUpdatePacketInterval, TimeUnit.MILLISECONDS) scheduleAtFixedRate(Runnable {