From ce7d8c03b37762a6d33818a97f03210b96bfaf58 Mon Sep 17 00:00:00 2001 From: sunqihong Date: Tue, 23 Nov 2021 11:20:24 +0800 Subject: [PATCH] =?UTF-8?q?2.0.2=20=E5=B9=B2=E6=8E=89log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blive-danmaku-client-jvm/build.gradle.kts | 2 +- .../com/ggemo/va/blivedanmakuclient/handler/MsgHandler.kt | 7 ++----- .../inner/handlers/impl/msgLoopManagerImpl.kt | 4 +--- .../inner/handlers/impl/socketIniterImpl.kt | 3 +-- .../src/test/kotlin/BLiveDanmakuTest.kt | 2 +- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/blive-danmaku-client-jvm/build.gradle.kts b/blive-danmaku-client-jvm/build.gradle.kts index 1b0f828..a8b869d 100644 --- a/blive-danmaku-client-jvm/build.gradle.kts +++ b/blive-danmaku-client-jvm/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } val projectGroup: String = "com.ggemo.va" -val projectVersion: String = "2.0.1-SNAPSHOT" +val projectVersion: String = "2.0.2-RELEASE" val projectName: String = "blive-danmaku-client" group = projectGroup diff --git a/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/handler/MsgHandler.kt b/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/handler/MsgHandler.kt index c01f210..51e9c22 100644 --- a/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/handler/MsgHandler.kt +++ b/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/handler/MsgHandler.kt @@ -2,25 +2,22 @@ package com.ggemo.va.blivedanmakuclient.handler import com.alibaba.fastjson.JSON import com.alibaba.fastjson.JSONObject -import com.ggemo.va.blivedanmakuclient.inner.handlers.impl.msgLoopManagerImpl -import org.slf4j.LoggerFactory import java.io.ByteArrayInputStream import java.io.DataInputStream import java.nio.charset.StandardCharsets import java.util.zip.Inflater open class MsgHandler: MsgHandlerItfc { - private val log = LoggerFactory.getLogger(msgLoopManagerImpl::class.java) override suspend fun handleRaw(data: ByteArray) { val dataLength = data.size if (dataLength < 16) { - log.warn("wrong data") + println("wrong data") } else { val inputStream = DataInputStream(ByteArrayInputStream(data)) val msgLength = inputStream.readInt() if (msgLength < 16) { - log.warn("maybe need expand size of cache") + println("maybe need expand size of cache") } else if (msgLength > 16 && msgLength == dataLength) { val headerLength = inputStream.readShort() val version = inputStream.readShort() diff --git a/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/inner/handlers/impl/msgLoopManagerImpl.kt b/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/inner/handlers/impl/msgLoopManagerImpl.kt index 753ac6d..c9d8160 100644 --- a/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/inner/handlers/impl/msgLoopManagerImpl.kt +++ b/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/inner/handlers/impl/msgLoopManagerImpl.kt @@ -5,14 +5,12 @@ import com.ggemo.va.blivedanmakuclient.handler.MsgHandlerItfc import com.ggemo.va.blivedanmakuclient.inner.util.readStreamUtil import com.ggemo.va.blivedanmakuclientkt.BLiveDanmakuApplication import com.ggemo.va.blivedanmakuclientkt.handlers.MsgLoopManager -import org.slf4j.LoggerFactory import java.io.DataInputStream import java.io.InputStream import java.net.Socket import java.util.concurrent.atomic.AtomicBoolean object msgLoopManagerImpl : MsgLoopManager { - private val log = LoggerFactory.getLogger(msgLoopManagerImpl::class.java) private val task2CancelMap = HashMap() override fun cancel(app: BLiveDanmakuApplication) { @@ -20,7 +18,7 @@ object msgLoopManagerImpl : MsgLoopManager { } override suspend fun start(socket: Socket, msgHandler: MsgHandlerItfc, app: BLiveDanmakuApplication) { - log.info("start!") + println("start!") var socketInputStream: InputStream val bufferSize = 10 * 1024 while (socket.getInputStream().also { socketInputStream = it } != null) { diff --git a/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/inner/handlers/impl/socketIniterImpl.kt b/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/inner/handlers/impl/socketIniterImpl.kt index 8d2223c..758e1b7 100644 --- a/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/inner/handlers/impl/socketIniterImpl.kt +++ b/blive-danmaku-client-jvm/src/main/kotlin/com/ggemo/va/blivedanmakuclient/inner/handlers/impl/socketIniterImpl.kt @@ -21,7 +21,6 @@ object socketIniterImpl : SocketIniter { socket.connect(address) return socket } - // todo: @sunqihong - throw RuntimeException() + throw RuntimeException("no danmaku server can reach") } } \ No newline at end of file diff --git a/blive-danmaku-client-jvm/src/test/kotlin/BLiveDanmakuTest.kt b/blive-danmaku-client-jvm/src/test/kotlin/BLiveDanmakuTest.kt index ec4dfa4..b124a30 100644 --- a/blive-danmaku-client-jvm/src/test/kotlin/BLiveDanmakuTest.kt +++ b/blive-danmaku-client-jvm/src/test/kotlin/BLiveDanmakuTest.kt @@ -9,7 +9,7 @@ import com.ggemo.va.blivedanmakuclientkt.Config fun main() { BLiveDanmakuApplication( Config( - 6, + 4767523, object : GivenMsgHandler() { override suspend fun userCount(userCount: Int) { println("气人值: $userCount")