Add request() method

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 80a8889106
commit d67a5e690f
  1. 11
      archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt

@ -95,8 +95,7 @@ public class Js5ChannelHandler(
Js5ResponseDecoder() Js5ResponseDecoder()
) )
val request = Js5Request.Group(false, Js5Archive.ARCHIVESET, Js5Archive.ARCHIVESET) request(Js5Archive.ARCHIVESET, Js5Archive.ARCHIVESET)
pendingRequests += request
} }
private fun handleClientOutOfDate(ctx: ChannelHandlerContext) { private fun handleClientOutOfDate(ctx: ChannelHandlerContext) {
@ -161,7 +160,7 @@ public class Js5ChannelHandler(
if (index != null) { if (index != null) {
processIndex(archive, index) processIndex(archive, index)
} else { } else {
pendingRequests += Js5Request.Group(false, Js5Archive.ARCHIVESET, archive) request(Js5Archive.ARCHIVESET, archive)
} }
} }
} finally { } finally {
@ -188,10 +187,14 @@ public class Js5ChannelHandler(
importer.importIndexAndGetMissingGroups(archive, index, buf) importer.importIndexAndGetMissingGroups(archive, index, buf)
} }
for (group in groups) { 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() { private fun releaseGroups() {
groups.forEach(CacheImporter.Group::release) groups.forEach(CacheImporter.Group::release)
groups.clear() groups.clear()

Loading…
Cancel
Save