From 85f497f6190e7bd3a267f9cdf61e9ee1215f9a72 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 13 Jun 2021 13:31:59 +0100 Subject: [PATCH] Treat a world list checksum of 0 as 1 This fixes a 1 in 2^32 chance that we'll fail to fetch the world list on startup. Of course, updating the player counts will still be borked if we get a collision, but at least the client won't break entirely. Signed-off-by: Graham --- .../org/openrs2/game/net/login/LoginChannelHandler.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt b/game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt index f1bfeef1..17719c3e 100644 --- a/game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt +++ b/game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt @@ -82,7 +82,15 @@ public class LoginChannelHandler @Inject constructor( private fun handleRequestWorldList(ctx: ChannelHandlerContext, msg: LoginRequest.RequestWorldList) { val (worlds, players) = cluster.getWorldList() - val checksum = worlds.hashCode() + var checksum = worlds.hashCode() + + /* + * Fix a 1 in 2^32 chance that we'll fail to fetch the original world + * list on startup. + */ + if (checksum == 0) { + checksum = 1 + } val worldList = if (checksum != msg.checksum) { WorldListResponse.WorldList(worlds, checksum)