ktor
This commit is contained in:
parent
9f89678c45
commit
48f25a825b
|
|
@ -26,14 +26,15 @@ import java.nio.ByteBuffer
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
|
|
||||||
object KtorServer {
|
object KtorServer {
|
||||||
private var port = 12345
|
|
||||||
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
|
||||||
//每个片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(CIO, port) {
|
||||||
|
|
@ -65,11 +66,12 @@ object KtorServer {
|
||||||
ser?.stop()
|
ser?.stop()
|
||||||
}
|
}
|
||||||
} while (port < 13000)
|
} while (port < 13000)
|
||||||
|
SpiderDebug.log("ktorServer start on $port")
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 启动服务器 */
|
/** 启动服务器 */
|
||||||
fun start() {
|
fun start() {
|
||||||
SpiderDebug.log("ktorServer start on $port")
|
|
||||||
CoroutineScope(Dispatchers.IO).launch { init() }
|
CoroutineScope(Dispatchers.IO).launch { init() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
7610a4d16212252a8db5108551e7c9a7
|
46bad00e2ccaae7cab15eb89fdb0e832
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://gh.llkk.cc/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;7610a4d16212252a8db5108551e7c9a7",
|
"spider": "https://gh.llkk.cc/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;46bad00e2ccaae7cab15eb89fdb0e832",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "电视直播",
|
"name": "电视直播",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue