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 <gpe@openrs2.org>
bzip2
Graham 3 years ago
parent 3edc5f1907
commit 85f497f619
  1. 10
      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)

Loading…
Cancel
Save