mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
fix(Telepathy): Implement OnServerConnectedWithAddress
This commit is contained in:
parent
ce0f70249b
commit
6de9697e0c
@ -11,7 +11,7 @@ public class Server : Common
|
||||
{
|
||||
// events to hook into
|
||||
// => OnData uses ArraySegment for allocation free receives later
|
||||
public Action<int> OnConnected;
|
||||
public Action<int, string> OnConnected;
|
||||
public Action<int, ArraySegment<byte>> OnData;
|
||||
public Action<int> OnDisconnected;
|
||||
|
||||
@ -388,7 +388,7 @@ public int Tick(int processLimit, Func<bool> checkEnabled = null)
|
||||
switch (eventType)
|
||||
{
|
||||
case EventType.Connected:
|
||||
OnConnected?.Invoke(connectionId);
|
||||
OnConnected?.Invoke(connectionId, GetClientAddress(connectionId));
|
||||
break;
|
||||
case EventType.Data:
|
||||
OnData?.Invoke(connectionId, message);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user