Close JS5 connection if an invalid file is requested

This mimics the behaviour of the OSRS server.

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent f48d23c4b9
commit fbb9694feb
  1. 16
      game/src/main/kotlin/org/openrs2/game/net/js5/Js5Service.kt

@ -12,6 +12,7 @@ import org.openrs2.cache.VersionTrailer
import org.openrs2.protocol.js5.Js5Request
import org.openrs2.protocol.js5.Js5Response
import org.openrs2.util.collect.UniqueQueue
import java.io.FileNotFoundException
import javax.inject.Inject
import javax.inject.Singleton
@ -66,12 +67,17 @@ public class Js5Service @Inject constructor(
}
}
} else {
store.read(request.archive, request.group).use { buf ->
if (request.archive != Js5Archive.ARCHIVESET) {
VersionTrailer.strip(buf)
}
try {
store.read(request.archive, request.group).use { buf ->
if (request.archive != Js5Archive.ARCHIVESET) {
VersionTrailer.strip(buf)
}
buf.retain()
buf.retain()
}
} catch (ex: FileNotFoundException) {
ctx.close()
return
}
}

Loading…
Cancel
Save