|
|
@ -35,7 +35,7 @@ public class Js5ChannelHandler( |
|
|
|
private val hostname: String, |
|
|
|
private val hostname: String, |
|
|
|
private val port: Int, |
|
|
|
private val port: Int, |
|
|
|
private var build: Int, |
|
|
|
private var build: Int, |
|
|
|
private val previousMasterIndexId: Int?, |
|
|
|
private val lastMasterIndexId: Int?, |
|
|
|
private val continuation: Continuation<Unit>, |
|
|
|
private val continuation: Continuation<Unit>, |
|
|
|
private val importer: CacheImporter, |
|
|
|
private val importer: CacheImporter, |
|
|
|
private val masterIndexFormat: MasterIndexFormat = MasterIndexFormat.VERSIONED, |
|
|
|
private val masterIndexFormat: MasterIndexFormat = MasterIndexFormat.VERSIONED, |
|
|
@ -45,7 +45,7 @@ public class Js5ChannelHandler( |
|
|
|
private val maxBuild = build + maxBuildAttempts |
|
|
|
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 currentMasterIndexId: Int = 0 |
|
|
|
private var masterIndexId: Int = 0 |
|
|
|
private var masterIndex: Js5MasterIndex? = null |
|
|
|
private var masterIndex: Js5MasterIndex? = null |
|
|
|
private lateinit var indexes: Array<Js5Index?> |
|
|
|
private lateinit var indexes: Array<Js5Index?> |
|
|
|
private val groups = mutableListOf<CacheImporter.Group>() |
|
|
|
private val groups = mutableListOf<CacheImporter.Group>() |
|
|
@ -144,7 +144,7 @@ public class Js5ChannelHandler( |
|
|
|
|
|
|
|
|
|
|
|
if (complete) { |
|
|
|
if (complete) { |
|
|
|
runBlocking { |
|
|
|
runBlocking { |
|
|
|
importer.setMasterIndexId(gameId, currentMasterIndexId) |
|
|
|
importer.setLastMasterIndexId(gameId, masterIndexId) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx.close() |
|
|
|
ctx.close() |
|
|
@ -164,7 +164,7 @@ public class Js5ChannelHandler( |
|
|
|
uncompressed, |
|
|
|
uncompressed, |
|
|
|
gameId, |
|
|
|
gameId, |
|
|
|
build, |
|
|
|
build, |
|
|
|
previousMasterIndexId, |
|
|
|
lastMasterIndexId, |
|
|
|
timestamp = Instant.now(), |
|
|
|
timestamp = Instant.now(), |
|
|
|
name |
|
|
|
name |
|
|
|
) |
|
|
|
) |
|
|
@ -183,7 +183,7 @@ public class Js5ChannelHandler( |
|
|
|
rawIndexes.filterNotNull().forEach(ByteBuf::release) |
|
|
|
rawIndexes.filterNotNull().forEach(ByteBuf::release) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentMasterIndexId = id |
|
|
|
masterIndexId = id |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -202,7 +202,7 @@ public class Js5ChannelHandler( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val groups = runBlocking { |
|
|
|
val groups = runBlocking { |
|
|
|
importer.importIndexAndGetMissingGroups(archive, index, buf, uncompressed, previousMasterIndexId) |
|
|
|
importer.importIndexAndGetMissingGroups(archive, index, buf, uncompressed, lastMasterIndexId) |
|
|
|
} |
|
|
|
} |
|
|
|
for (group in groups) { |
|
|
|
for (group in groups) { |
|
|
|
request(archive, group) |
|
|
|
request(archive, group) |
|
|
|