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()
)
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()

Loading…
Cancel
Save