浏览代码

Change all system property names `mirai.debug.network.*` to `mirai.network.*`

Him188 4 年之前
父节点
当前提交
3fc6fbed85

+ 4 - 4
.github/workflows/build.yml

@@ -27,9 +27,9 @@ jobs:
       - name: mirai-core Tests
         run: >
           ./gradlew check --scan
-          -Dmirai.debug.network.show.all.components=true
+          -Dmirai.network.show.all.components=true
           -Dkotlinx.coroutines.debug=on
-          -Dmirai.debug.network.show.packet.details=true
+          -Dmirai.network.show.packet.details=true
   build-all:
     runs-on: ubuntu-latest
     steps:
@@ -56,6 +56,6 @@ jobs:
       - name: All Tests
         run: >
           ./gradlew check --scan
-          -Dmirai.debug.network.show.all.components=true
+          -Dmirai.network.show.all.components=true
           -Dkotlinx.coroutines.debug=on
-          -Dmirai.debug.network.show.packet.details=true
+          -Dmirai.network.show.packet.details=true

+ 2 - 2
.github/workflows/release.yml

@@ -63,9 +63,9 @@ jobs:
       - name: Check
         run: >
           ./gradlew check --scan
-          -Dmirai.debug.network.show.all.components=true
+          -Dmirai.network.show.all.components=true
           -Dkotlinx.coroutines.debug=on
-          -Dmirai.debug.network.show.packet.details=true
+          -Dmirai.network.show.packet.details=true
 
       - name: Gradle :mirai-core-utils:publish
         run: >

+ 2 - 2
mirai-core/src/commonMain/kotlin/network/component/ConcurrentComponentStorage.kt

@@ -64,10 +64,10 @@ internal inline fun ConcurrentComponentStorage(builderAction: ConcurrentComponen
     return ConcurrentComponentStorage().apply(builderAction)
 }
 
-private val SHOW_ALL_COMPONENTS: Boolean by lazy(NONE) { systemProp("mirai.debug.network.show.all.components", false) }
+private val SHOW_ALL_COMPONENTS: Boolean by lazy(NONE) { systemProp("mirai.network.show.all.components", false) }
 private val SHOW_COMPONENTS_CREATION_STACKTRACE: Boolean by lazy(NONE) {
     systemProp(
-        "mirai.debug.network.show.components.creation.stacktrace",
+        "mirai.network.show.components.creation.stacktrace",
         false
     )
 }

+ 1 - 1
mirai-core/src/commonMain/kotlin/network/components/PacketCodec.kt

@@ -42,7 +42,7 @@ internal interface PacketCodec {
     suspend fun processBody(bot: QQAndroidBot, input: RawIncomingPacket): IncomingPacket?
 
     companion object : ComponentKey<PacketCodec> {
-        val PACKET_DEBUG = systemProp("mirai.debug.network.packet.logger", false)
+        val PACKET_DEBUG = systemProp("mirai.network.packet.logger", false)
 
         internal val PacketLogger: MiraiLoggerWithSwitch by lazy {
             MiraiLogger.create("Packet").withSwitch(PACKET_DEBUG)

+ 2 - 2
mirai-core/src/commonMain/kotlin/network/components/PacketLoggingStrategy.kt

@@ -90,7 +90,7 @@ internal class PacketLoggingStrategyImpl(
 
     companion object {
         fun getDefaultBlacklist(): Set<String> {
-            if (systemProp("mirai.debug.network.show.verbose.packets", false)) return emptySet()
+            if (systemProp("mirai.network.show.verbose.packets", false)) return emptySet()
             return DEFAULT_BLACKLIST
         }
 
@@ -112,6 +112,6 @@ internal class PacketLoggingStrategyImpl(
         }
 
         @JvmField
-        var SHOW_PACKET_DETAILS = systemProp("mirai.debug.network.show.packet.details", false)
+        var SHOW_PACKET_DETAILS = systemProp("mirai.network.show.packet.details", false)
     }
 }

+ 2 - 1
mirai-core/src/commonMain/kotlin/network/handler/selector/AbstractKeepAliveNetworkHandlerSelector.kt

@@ -199,7 +199,8 @@ internal abstract class AbstractKeepAliveNetworkHandlerSelector<H : NetworkHandl
          * millis
          */
         @JvmField
-        var RECONNECT_DELAY = systemProp("mirai.network.reconnect.delay", 3000)
+        var RECONNECT_DELAY = systemProp("mirai.network.reconnect.delay", 3000L)
+            .coerceIn(0..Long.MAX_VALUE)
 
         @JvmField
         var SELECTOR_LOGGING = systemProp("mirai.network.handle.selector.logging", false)

+ 1 - 1
mirai-core/src/commonMain/kotlin/network/handler/state/LoggingStateObserver.kt

@@ -76,7 +76,7 @@ internal class LoggingStateObserver(
          * - `full` for logging with stacktrace
          */
         var ENABLED = systemProp(
-            "mirai.debug.network.state.observer.logging",
+            "mirai.network.state.observer.logging",
             "off"
         ).lowercase()
 

+ 4 - 4
mirai-core/src/commonTest/kotlin/test/initPlatform.common.kt

@@ -30,10 +30,10 @@ abstract class AbstractTest {
             SynchronizedStdoutLogger(it)
         }
 
-        System.setProperty("mirai.debug.network.packet.logger", "true")
-        System.setProperty("mirai.debug.network.state.observer.logging", "true")
-        System.setProperty("mirai.debug.network.show.all.components", "true")
-        System.setProperty("mirai.debug.network.show.components.creation.stacktrace", "true")
+        System.setProperty("mirai.network.packet.logger", "true")
+        System.setProperty("mirai.network.state.observer.logging", "true")
+        System.setProperty("mirai.network.show.all.components", "true")
+        System.setProperty("mirai.network.show.components.creation.stacktrace", "true")
         System.setProperty("mirai.network.handle.selector.logging", "true")
 
     }