Rename version to build

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent 689c315bf3
commit f3ea8e71fe
  1. 12
      archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt
  2. 6
      protocol/src/main/kotlin/org/openrs2/protocol/login/InitJs5RemoteConnectionCodec.kt
  3. 2
      protocol/src/main/kotlin/org/openrs2/protocol/login/LoginRequest.kt

@ -32,13 +32,13 @@ public class Js5ChannelHandler(
private val gameId: Int, private val gameId: Int,
private val hostname: String, private val hostname: String,
private val port: Int, private val port: Int,
private var version: Int, private var build: Int,
private val continuation: Continuation<Unit>, private val continuation: Continuation<Unit>,
private val importer: CacheImporter, private val importer: CacheImporter,
private val maxInFlightRequests: Int = 200, private val maxInFlightRequests: Int = 200,
maxVersionAttempts: Int = 10 maxBuildAttempts: Int = 10
) : SimpleChannelInboundHandler<Any>(Object::class.java) { ) : SimpleChannelInboundHandler<Any>(Object::class.java) {
private val maxVersion = version + maxVersionAttempts private val maxBuild = build + maxBuildAttempts
private val inFlightRequests = mutableSetOf<Js5Request.Group>() private val inFlightRequests = mutableSetOf<Js5Request.Group>()
private val pendingRequests = ArrayDeque<Js5Request.Group>() private val pendingRequests = ArrayDeque<Js5Request.Group>()
private var masterIndex: Js5MasterIndex? = null private var masterIndex: Js5MasterIndex? = null
@ -46,7 +46,7 @@ public class Js5ChannelHandler(
private val groups = mutableListOf<CacheImporter.Group>() private val groups = mutableListOf<CacheImporter.Group>()
override fun channelActive(ctx: ChannelHandlerContext) { override fun channelActive(ctx: ChannelHandlerContext) {
ctx.writeAndFlush(LoginRequest.InitJs5RemoteConnection(version), ctx.voidPromise()) ctx.writeAndFlush(LoginRequest.InitJs5RemoteConnection(build), ctx.voidPromise())
ctx.read() ctx.read()
} }
@ -103,7 +103,7 @@ public class Js5ChannelHandler(
} }
private fun handleClientOutOfDate(ctx: ChannelHandlerContext) { private fun handleClientOutOfDate(ctx: ChannelHandlerContext) {
if (++version > maxVersion) { if (++build > maxBuild) {
throw Exception("Failed to identify current version") throw Exception("Failed to identify current version")
} }
@ -156,7 +156,7 @@ public class Js5ChannelHandler(
Js5MasterIndex.read(uncompressed) Js5MasterIndex.read(uncompressed)
} }
val rawIndexes = runBlocking { importer.importMasterIndexAndGetIndexes(masterIndex!!, buf, gameId, version) } val rawIndexes = runBlocking { importer.importMasterIndexAndGetIndexes(masterIndex!!, buf, gameId, build) }
try { try {
indexes = arrayOfNulls(rawIndexes.size) indexes = arrayOfNulls(rawIndexes.size)

@ -9,11 +9,11 @@ public object InitJs5RemoteConnectionCodec : PacketCodec<LoginRequest.InitJs5Rem
length = 4 length = 4
) { ) {
override fun decode(input: ByteBuf): LoginRequest.InitJs5RemoteConnection { override fun decode(input: ByteBuf): LoginRequest.InitJs5RemoteConnection {
val version = input.readInt() val build = input.readInt()
return LoginRequest.InitJs5RemoteConnection(version) return LoginRequest.InitJs5RemoteConnection(build)
} }
override fun encode(input: LoginRequest.InitJs5RemoteConnection, output: ByteBuf) { override fun encode(input: LoginRequest.InitJs5RemoteConnection, output: ByteBuf) {
output.writeInt(input.version) output.writeInt(input.build)
} }
} }

@ -3,5 +3,5 @@ package org.openrs2.protocol.login
import org.openrs2.protocol.Packet import org.openrs2.protocol.Packet
public sealed class LoginRequest : Packet { public sealed class LoginRequest : Packet {
public data class InitJs5RemoteConnection(public val version: Int) : LoginRequest() public data class InitJs5RemoteConnection(public val build: Int) : LoginRequest()
} }

Loading…
Cancel
Save