Simplified connection log info for debug output
This commit is contained in:
parent
c62016dad9
commit
53f7cd8cf1
|
@ -555,7 +555,7 @@ open class Client<CONNECTION : Connection>(config: ClientConfiguration = ClientC
|
|||
)
|
||||
|
||||
val pubSub = handshakeConnection.pubSub
|
||||
val logInfo = pubSub.getLogInfo(logger.isDebugEnabled)
|
||||
val logInfo = pubSub.getLogInfo(logger)
|
||||
|
||||
if (logger.isDebugEnabled) {
|
||||
logger.debug("Creating new handshake to $logInfo")
|
||||
|
@ -751,7 +751,7 @@ open class Client<CONNECTION : Connection>(config: ClientConfiguration = ClientC
|
|||
)
|
||||
|
||||
val pubSub = clientConnection.connectionInfo
|
||||
val logInfo = pubSub.getLogInfo(logger.isDebugEnabled)
|
||||
val logInfo = pubSub.getLogInfo(logger)
|
||||
|
||||
if (logger.isDebugEnabled) {
|
||||
logger.debug("Creating new connection to $logInfo")
|
||||
|
|
|
@ -163,7 +163,7 @@ open class Connection(connectionParameters: ConnectionParams<*>) {
|
|||
rmi = endPoint.rmiConnectionSupport.getNewRmiSupport(this)
|
||||
|
||||
// For toString() and logging
|
||||
toString0 = info.getLogInfo(logger.isDebugEnabled)
|
||||
toString0 = info.getLogInfo(logger)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -355,7 +355,7 @@ open class Connection(connectionParameters: ConnectionParams<*>) {
|
|||
}
|
||||
|
||||
// make sure to save off the RMI objects for session management
|
||||
if (!closeEverything && endPoint.sessionManager.enabled()) {
|
||||
if (!closeEverything) {
|
||||
endPoint.sessionManager.onDisconnect(this as SessionConnection)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package dorkbox.network.handshake
|
|||
|
||||
import io.aeron.Publication
|
||||
import io.aeron.Subscription
|
||||
import org.slf4j.Logger
|
||||
import java.net.Inet4Address
|
||||
import java.net.InetAddress
|
||||
|
||||
|
@ -36,12 +37,13 @@ data class PubSub(
|
|||
) {
|
||||
val isIpc get() = remoteAddress == null
|
||||
|
||||
fun getLogInfo(debugEnabled: Boolean): String {
|
||||
fun getLogInfo(logger: Logger): String {
|
||||
val detailed = logger.isTraceEnabled
|
||||
return if (isIpc) {
|
||||
if (debugEnabled) {
|
||||
if (detailed) {
|
||||
"IPC sessionID: p=${sessionIdPub} s=${sessionIdSub}, streamID: p=${streamIdPub} s=${streamIdSub}, reg: p=${pub.registrationId()} s=${sub.registrationId()}"
|
||||
} else {
|
||||
"IPC [${sessionIdPub}|${sessionIdSub}|${streamIdPub}|${streamIdSub}]"
|
||||
"IPC"
|
||||
}
|
||||
} else {
|
||||
val prefix = if (remoteAddress is Inet4Address) {
|
||||
|
@ -50,10 +52,10 @@ data class PubSub(
|
|||
"IPv6 $remoteAddressString"
|
||||
}
|
||||
|
||||
if (debugEnabled) {
|
||||
if (detailed) {
|
||||
"$prefix sessionID: p=${sessionIdPub} s=${sessionIdSub}, streamID: p=${streamIdPub} s=${streamIdSub}, port: p=${portPub} s=${portSub}, reg: p=${pub.registrationId()} s=${sub.registrationId()}"
|
||||
} else {
|
||||
"$prefix [${sessionIdPub}|${sessionIdSub}|${streamIdPub}|${streamIdSub}|${portPub}|${portSub}]"
|
||||
prefix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ internal class ServerHandshake<CONNECTION : Connection>(
|
|||
reliable = true
|
||||
)
|
||||
|
||||
val logInfo = newConnectionDriver.pubSub.getLogInfo(logger.isDebugEnabled)
|
||||
val logInfo = newConnectionDriver.pubSub.getLogInfo(logger)
|
||||
if (logger.isDebugEnabled) {
|
||||
logger.debug("Creating new connection to $logInfo")
|
||||
} else {
|
||||
|
@ -582,7 +582,7 @@ internal class ServerHandshake<CONNECTION : Connection>(
|
|||
val cryptoSecretKey = server.crypto.generateAesKey(clientPublicKeyBytes, clientPublicKeyBytes, server.crypto.publicKeyBytes)
|
||||
|
||||
|
||||
val logInfo = newConnectionDriver.pubSub.getLogInfo(logger.isDebugEnabled)
|
||||
val logInfo = newConnectionDriver.pubSub.getLogInfo(logger)
|
||||
if (logger.isDebugEnabled) {
|
||||
logger.debug("Creating new connection to $logInfo")
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue