From 9dcc6a0953c4705415187db9e902512e9fba1c87 Mon Sep 17 00:00:00 2001 From: MrGadget <9826063+MrGadget1024@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:05:21 -0400 Subject: [PATCH] fix(Telepathy): Implement OnServerConnectedWithAddress --- Assets/Mirror/Transports/Telepathy/Telepathy/Server.cs | 4 ++-- Assets/Mirror/Transports/Telepathy/TelepathyTransport.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Mirror/Transports/Telepathy/Telepathy/Server.cs b/Assets/Mirror/Transports/Telepathy/Telepathy/Server.cs index 08af60629..6a31859d3 100644 --- a/Assets/Mirror/Transports/Telepathy/Telepathy/Server.cs +++ b/Assets/Mirror/Transports/Telepathy/Telepathy/Server.cs @@ -11,7 +11,7 @@ public class Server : Common { // events to hook into // => OnData uses ArraySegment for allocation free receives later - public Action OnConnected; + public Action OnConnected; public Action> OnData; public Action OnDisconnected; @@ -388,7 +388,7 @@ public int Tick(int processLimit, Func checkEnabled = null) switch (eventType) { case EventType.Connected: - OnConnected?.Invoke(connectionId); + OnConnected?.Invoke(connectionId, GetClientAddress(connectionId)); break; case EventType.Data: OnData?.Invoke(connectionId, message); diff --git a/Assets/Mirror/Transports/Telepathy/TelepathyTransport.cs b/Assets/Mirror/Transports/Telepathy/TelepathyTransport.cs index f4276884e..bbb80b49c 100644 --- a/Assets/Mirror/Transports/Telepathy/TelepathyTransport.cs +++ b/Assets/Mirror/Transports/Telepathy/TelepathyTransport.cs @@ -178,7 +178,7 @@ public override void ServerStart() // system's hook (e.g. statistics OnData) was added is to wrap // them all in a lambda and always call the latest hook. // (= lazy call) - server.OnConnected = (connectionId) => OnServerConnected.Invoke(connectionId); + server.OnConnected = (connectionId, remoteClientAddress) => OnServerConnectedWithAddress.Invoke(connectionId, remoteClientAddress); server.OnData = (connectionId, segment) => OnServerDataReceived.Invoke(connectionId, segment, Channels.Reliable); server.OnDisconnected = (connectionId) => OnServerDisconnected.Invoke(connectionId);