Cleaned up ordering of connection initialization
This commit is contained in:
parent
b55168a3eb
commit
0825274bd0
|
@ -804,8 +804,6 @@ open class Client<CONNECTION : Connection>(config: ClientConfiguration = ClientC
|
|||
logger.debug("[${handshakeConnection.details}] (${handshake.connectKey}) Connection (${newConnection.id}) to [$addressString] done with handshake.")
|
||||
}
|
||||
|
||||
newConnection.setImage()
|
||||
|
||||
// in the specific case of using sessions, we don't want to call 'init' or `connect` for a connection that is resuming a session
|
||||
var newSession = true
|
||||
if (sessionManager.enabled()) {
|
||||
|
@ -813,6 +811,7 @@ open class Client<CONNECTION : Connection>(config: ClientConfiguration = ClientC
|
|||
newSession = sessionManager.onInit(newConnection as SessionConnection)
|
||||
}
|
||||
|
||||
newConnection.setImage()
|
||||
|
||||
// before we finish creating the connection, we initialize it (in case there needs to be logic that happens-before `onConnect` calls
|
||||
if (newSession) {
|
||||
|
|
|
@ -133,8 +133,6 @@ internal class ServerHandshake<CONNECTION : Connection>(
|
|||
logger.debug("[${newConnection}] (${message.connectKey}) Connection done with handshake.")
|
||||
}
|
||||
|
||||
newConnection.setImage()
|
||||
|
||||
// in the specific case of using sessions, we don't want to call 'init' or `connect` for a connection that is resuming a session
|
||||
var newSession = true
|
||||
if (server.sessionManager.enabled()) {
|
||||
|
@ -142,6 +140,8 @@ internal class ServerHandshake<CONNECTION : Connection>(
|
|||
newSession = server.sessionManager.onInit(newConnection as SessionConnection)
|
||||
}
|
||||
|
||||
newConnection.setImage()
|
||||
|
||||
// before we finish creating the connection, we initialize it (in case there needs to be logic that happens-before `onConnect` calls
|
||||
if (newSession) {
|
||||
listenerManager.notifyInit(newConnection)
|
||||
|
|
Loading…
Reference in New Issue