diff --git a/app/build.gradle b/app/build.gradle index cd2c1b79..f419cdde 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -85,7 +85,7 @@ dependencies { implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1" 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("org.slf4j:slf4j-android:1.7.36") diff --git a/app/src/main/java/com/github/catvod/utils/ktorServer.kt b/app/src/main/java/com/github/catvod/utils/ktorServer.kt index 734a785a..4855cf73 100644 --- a/app/src/main/java/com/github/catvod/utils/ktorServer.kt +++ b/app/src/main/java/com/github/catvod/utils/ktorServer.kt @@ -9,8 +9,9 @@ import io.ktor.http.HttpStatusCode import io.ktor.server.application.ApplicationCall import io.ktor.server.application.call import io.ktor.server.application.install -import io.ktor.server.cio.CIO + import io.ktor.server.engine.embeddedServer +import io.ktor.server.netty.Netty import io.ktor.server.plugins.callloging.CallLogging import io.ktor.server.response.respondBytesWriter import io.ktor.server.response.respondText @@ -30,14 +31,14 @@ object KtorServer { private val THREAD_NUM = Runtime.getRuntime().availableProcessors() * 2 private val infos = mutableMapOf>() var ser: io.ktor.server.engine.ApplicationEngine? = null - var port = 12345 + var port = 10010 //每个片1MB private val partSize = 1024 * 1024 * 1 fun init() { do { try { - ser = embeddedServer(CIO, port) { + ser = embeddedServer(Netty, port) { install(CallLogging) @@ -59,7 +60,8 @@ object KtorServer { ) } } - }.start(wait = false) + }.start(wait = true) + } catch (e: Exception) { SpiderDebug.log("start server e:" + e.message) ++port diff --git a/jar/custom_spider.jar b/jar/custom_spider.jar index b6709e0a..fc4032a0 100644 Binary files a/jar/custom_spider.jar and b/jar/custom_spider.jar differ diff --git a/jar/custom_spider.jar.md5 b/jar/custom_spider.jar.md5 index 4d589ce4..f3464f06 100644 --- a/jar/custom_spider.jar.md5 +++ b/jar/custom_spider.jar.md5 @@ -1 +1 @@ -46bad00e2ccaae7cab15eb89fdb0e832 +688459e2a29a8e04d0051e79abe6036a diff --git a/json/test.json b/json/test.json index e1a519cd..7a71be4a 100644 --- a/json/test.json +++ b/json/test.json @@ -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": [ { "name": "电视直播",