diff --git a/src/dorkbox/network/handshake/ClientConnectionInfo.kt b/src/dorkbox/network/handshake/ClientConnectionInfo.kt index 3e5a3481..2b5bc4be 100644 --- a/src/dorkbox/network/handshake/ClientConnectionInfo.kt +++ b/src/dorkbox/network/handshake/ClientConnectionInfo.kt @@ -15,16 +15,10 @@ */ package dorkbox.network.handshake -import org.slf4j.Logger - internal class ClientConnectionInfo(val subscriptionPort: Int, val publicationPort: Int, val sessionId: Int, val streamId: Int, val publicKey: ByteArray, val kryoIdsForRmi: IntArray) { - - fun log(handshakeSessionId: Int, logger: Logger) { - logger.debug("[{}] connected {}|{} (encrypted {})", handshakeSessionId, publicationPort, subscriptionPort, sessionId) - } } diff --git a/src/dorkbox/network/handshake/ClientHandshake.kt b/src/dorkbox/network/handshake/ClientHandshake.kt index f541d1cb..ab2ec0ef 100644 --- a/src/dorkbox/network/handshake/ClientHandshake.kt +++ b/src/dorkbox/network/handshake/ClientHandshake.kt @@ -82,7 +82,6 @@ internal class ClientHandshake(private val logger: KLogg // The message was intended for this client. Try to parse it as one of the available message types. // this message is ENCRYPTED! connectionHelloInfo = crypto.decrypt(message.registrationData, message.publicKey) - connectionHelloInfo!!.log(sessionId, logger) } HandshakeMessage.DONE_ACK -> { diff --git a/src/dorkbox/network/handshake/ServerHandshake.kt b/src/dorkbox/network/handshake/ServerHandshake.kt index f8492b34..8e7c16f5 100644 --- a/src/dorkbox/network/handshake/ServerHandshake.kt +++ b/src/dorkbox/network/handshake/ServerHandshake.kt @@ -79,7 +79,10 @@ internal class ServerHandshake(private val logger: KLog pendingConnectionsLock.write { val pendingConnection = pendingConnections.remove(sessionId) if (pendingConnection != null) { - logger.debug("Connection from client $clientAddressString ready") + logger.trace { "Connection from client $clientAddressString done with handshake." } + + // this enables the connection to start polling for messages + server.connections.add(pendingConnection) // now tell the client we are done server.writeHandshakeMessage(handshakePublication, HandshakeMessage.doneToClient(sessionId)) @@ -88,9 +91,6 @@ internal class ServerHandshake(private val logger: KLog listenerManager.notifyConnect(pendingConnection) } - // this enables the connection to start polling for messages - server.connections.add(pendingConnection) - return } } @@ -199,11 +199,11 @@ internal class ServerHandshake(private val logger: KLog // we have to construct how the connection will communicate! clientConnection.buildServer(aeron) - logger.trace { - "Creating new connection $clientConnection" + logger.info { + "Creating new connection from $clientConnection" } - val connection = server.newConnection(ConnectionParams(server, clientConnection, validateRemoteAddress)) as CONNECTION + val connection = server.newConnection(ConnectionParams(server, clientConnection, validateRemoteAddress)) // VALIDATE:: are we allowed to connect to this server (now that we have the initial server information) @Suppress("UNCHECKED_CAST") @@ -214,8 +214,6 @@ internal class ServerHandshake(private val logger: KLog sessionIdAllocator.free(connectionSessionId) streamIdAllocator.free(connectionStreamId) - logger.error("Error creating new connection") - val exception = ClientRejectedException("Connection was not permitted!") ListenerManager.cleanStackTrace(exception) listenerManager.notifyError(connection, exception) @@ -231,8 +229,10 @@ internal class ServerHandshake(private val logger: KLog /////////////// // if necessary (and only for RMI id's that have never been seen before) we want to re-write our kryo information - val rmiModificationIds = message.registrationRmiIdData!! - server.updateKryoIdsForRmi(connection, rmiModificationIds) + serialization.updateKryoIdsForRmi(connection, message.registrationRmiIdData!!) { errorMessage -> + listenerManager.notifyError(connection, + ClientRejectedException(errorMessage)) + }