fix(EncryptionTransport): Implement OnServerConnectedWithAddress

This commit is contained in:
MrGadget 2024-07-11 11:32:50 -04:00
parent 63b7113ec9
commit 131b2d3022

View File

@ -76,7 +76,9 @@ private void HandleInnerServerDataReceived(int connId, ArraySegment<byte> 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;