From 938cdc6c2a69fdeeb08e0008c3956a734c6c625e Mon Sep 17 00:00:00 2001 From: MrGadget <9826063+MrGadget1024@users.noreply.github.com> Date: Thu, 11 Jul 2024 11:32:50 -0400 Subject: [PATCH] fix(EncryptionTransport): Implement OnServerConnectedWithAddress --- .../Mirror/Transports/Encryption/EncryptionTransport.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Assets/Mirror/Transports/Encryption/EncryptionTransport.cs b/Assets/Mirror/Transports/Encryption/EncryptionTransport.cs index 5d9d9bb9a..26de24c6f 100644 --- a/Assets/Mirror/Transports/Encryption/EncryptionTransport.cs +++ b/Assets/Mirror/Transports/Encryption/EncryptionTransport.cs @@ -76,7 +76,9 @@ private void HandleInnerServerDataReceived(int connId, ArraySegment data, } } - private void HandleInnerServerConnected(int connId) + private void HandleInnerServerConnected(int connId) => HandleInnerServerConnected(connId, inner.ServerGetClientAddress(connId)); + + private void HandleInnerServerConnected(int connId, string clientRemoteAddress) { Debug.Log($"[EncryptionTransport] New connection #{connId}"); EncryptedConnection ec = null; @@ -89,7 +91,8 @@ private void HandleInnerServerConnected(int connId) { Debug.Log($"[EncryptionTransport] Connection #{connId} is ready"); ServerRemoveFromPending(ec); - OnServerConnected?.Invoke(connId); + //OnServerConnected?.Invoke(connId); + OnServerConnectedWithAddress?.Invoke(connId, clientRemoteAddress); }, (type, msg) => { @@ -206,6 +209,7 @@ public override void ServerStart() _credentials = EncryptionCredentials.Generate(); } inner.OnServerConnected = HandleInnerServerConnected; + inner.OnServerConnectedWithAddress = HandleInnerServerConnected; inner.OnServerDataReceived = HandleInnerServerDataReceived; inner.OnServerDataSent = (connId, bytes, channel) => OnServerDataSent?.Invoke(connId, bytes, channel); inner.OnServerError = HandleInnerServerError;