This commit is contained in:
lushunming 2025-07-18 15:10:59 +08:00
parent 48f25a825b
commit e970820b9b
5 changed files with 9 additions and 7 deletions

View File

@ -85,7 +85,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1"
implementation 'io.ktor:ktor-server-core:2.3.4' implementation 'io.ktor:ktor-server-core:2.3.4'
implementation 'io.ktor:ktor-server-cio:2.3.4' implementation 'io.ktor:ktor-server-netty:2.3.4'
implementation 'io.ktor:ktor-server-call-logging:2.3.4' implementation 'io.ktor:ktor-server-call-logging:2.3.4'
implementation("org.slf4j:slf4j-android:1.7.36") implementation("org.slf4j:slf4j-android:1.7.36")

View File

@ -9,8 +9,9 @@ import io.ktor.http.HttpStatusCode
import io.ktor.server.application.ApplicationCall import io.ktor.server.application.ApplicationCall
import io.ktor.server.application.call import io.ktor.server.application.call
import io.ktor.server.application.install import io.ktor.server.application.install
import io.ktor.server.cio.CIO
import io.ktor.server.engine.embeddedServer import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty
import io.ktor.server.plugins.callloging.CallLogging import io.ktor.server.plugins.callloging.CallLogging
import io.ktor.server.response.respondBytesWriter import io.ktor.server.response.respondBytesWriter
import io.ktor.server.response.respondText import io.ktor.server.response.respondText
@ -30,14 +31,14 @@ object KtorServer {
private val THREAD_NUM = Runtime.getRuntime().availableProcessors() * 2 private val THREAD_NUM = Runtime.getRuntime().availableProcessors() * 2
private val infos = mutableMapOf<String, Array<Any>>() private val infos = mutableMapOf<String, Array<Any>>()
var ser: io.ktor.server.engine.ApplicationEngine? = null var ser: io.ktor.server.engine.ApplicationEngine? = null
var port = 12345 var port = 10010
//每个片1MB //每个片1MB
private val partSize = 1024 * 1024 * 1 private val partSize = 1024 * 1024 * 1
fun init() { fun init() {
do { do {
try { try {
ser = embeddedServer(CIO, port) { ser = embeddedServer(Netty, port) {
install(CallLogging) install(CallLogging)
@ -59,7 +60,8 @@ object KtorServer {
) )
} }
} }
}.start(wait = false) }.start(wait = true)
} catch (e: Exception) { } catch (e: Exception) {
SpiderDebug.log("start server e:" + e.message) SpiderDebug.log("start server e:" + e.message)
++port ++port

Binary file not shown.

View File

@ -1 +1 @@
46bad00e2ccaae7cab15eb89fdb0e832 688459e2a29a8e04d0051e79abe6036a

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://gh.llkk.cc/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;46bad00e2ccaae7cab15eb89fdb0e832", "spider": "https://gh.llkk.cc/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;688459e2a29a8e04d0051e79abe6036a",
"lives": [ "lives": [
{ {
"name": "电视直播", "name": "电视直播",