代理视频的异常捕获

This commit is contained in:
lushunming 2025-11-17 08:15:51 +08:00
parent 565c92ce63
commit 26d525f436
1 changed files with 12 additions and 7 deletions

View File

@ -11,7 +11,7 @@ import kotlinx.coroutines.runBlocking
object ProxyServer {
private val THREAD_NUM = Runtime.getRuntime().availableProcessors()
private val THREAD_NUM = Runtime.getRuntime().availableProcessors()
private val partSize = 1024 * 1024 * 2
private var port = 12345
private var httpServer: AdvancedHttpServer? = null
@ -37,15 +37,20 @@ object ProxyServer {
}
};
httpServer?.addRoutes("/proxy") { req, response ->
run {
val key = req.queryParams["key"];
val url = urlMap[key]
val header = headerMap[key]
try {
run {
val key = req.queryParams["key"];
val url = urlMap[key]
val header = headerMap[key]
if (url != null && header != null) {
proxyAsync(url, header, req, response)
if (url != null && header != null) {
proxyAsync(url, header, req, response)
}
}
} catch (e: Exception) {
SpiderDebug.log("代理视频出错:" + e.message)
}
}
httpServer?.start()