diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt index 31c697f469..51a130587e 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt @@ -95,8 +95,7 @@ public class Js5ChannelHandler( Js5ResponseDecoder() ) - val request = Js5Request.Group(false, Js5Archive.ARCHIVESET, Js5Archive.ARCHIVESET) - pendingRequests += request + request(Js5Archive.ARCHIVESET, Js5Archive.ARCHIVESET) } private fun handleClientOutOfDate(ctx: ChannelHandlerContext) { @@ -161,7 +160,7 @@ public class Js5ChannelHandler( if (index != null) { processIndex(archive, index) } else { - pendingRequests += Js5Request.Group(false, Js5Archive.ARCHIVESET, archive) + request(Js5Archive.ARCHIVESET, archive) } } } finally { @@ -188,10 +187,14 @@ public class Js5ChannelHandler( importer.importIndexAndGetMissingGroups(archive, index, buf) } for (group in groups) { - pendingRequests += Js5Request.Group(false, archive, group) + request(archive, group) } } + private fun request(archive: Int, group: Int) { + pendingRequests += Js5Request.Group(false, archive, group) + } + private fun releaseGroups() { groups.forEach(CacheImporter.Group::release) groups.clear()