From aad625decc5844f3fc0f2f260a83198284ef62c2 Mon Sep 17 00:00:00 2001 From: MrGadget <9826063+MrGadget1024@users.noreply.github.com> Date: Thu, 11 Jul 2024 11:27:16 -0400 Subject: [PATCH] fix(MiddlewareTransport): Implement OnServerConnectedWithAddress --- .../Editor/Transports/MiddlewareTransportTest.cs | 14 +++++++------- .../Transports/Middleware/MiddlewareTransport.cs | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Assets/Mirror/Tests/Editor/Transports/MiddlewareTransportTest.cs b/Assets/Mirror/Tests/Editor/Transports/MiddlewareTransportTest.cs index 32af6cbf7..858e1050e 100644 --- a/Assets/Mirror/Tests/Editor/Transports/MiddlewareTransportTest.cs +++ b/Assets/Mirror/Tests/Editor/Transports/MiddlewareTransportTest.cs @@ -292,13 +292,13 @@ public void TestClientExceptionCallback() } [Test] - [TestCase(0)] - [TestCase(1)] - [TestCase(19)] - public void TestServerConnectedCallback(int id) + [TestCase(0, "")] + [TestCase(1, "")] + [TestCase(19, "")] + public void TestServerConnectedCallback(int id, string remoteClientAddress) { int called = 0; - middleware.OnServerConnected = (i) => + middleware.OnServerConnectedWithAddress = (i, remoteClientAddress) => { called++; Assert.That(i, Is.EqualTo(id)); @@ -306,10 +306,10 @@ public void TestServerConnectedCallback(int id) // start to give callback to inner middleware.ServerStart(); - inner.OnServerConnected.Invoke(id); + inner.OnServerConnectedWithAddress.Invoke(id, remoteClientAddress); Assert.That(called, Is.EqualTo(1)); - inner.OnServerConnected.Invoke(id); + inner.OnServerConnectedWithAddress.Invoke(id, remoteClientAddress); Assert.That(called, Is.EqualTo(2)); } diff --git a/Assets/Mirror/Transports/Middleware/MiddlewareTransport.cs b/Assets/Mirror/Transports/Middleware/MiddlewareTransport.cs index fc7c9cd00..21d2ac3ef 100644 --- a/Assets/Mirror/Transports/Middleware/MiddlewareTransport.cs +++ b/Assets/Mirror/Transports/Middleware/MiddlewareTransport.cs @@ -43,6 +43,7 @@ public override void ClientConnect(string address) public override void ServerStart() { inner.OnServerConnected = OnServerConnected; + inner.OnServerConnectedWithAddress = OnServerConnectedWithAddress; inner.OnServerDataReceived = OnServerDataReceived; inner.OnServerDisconnected = OnServerDisconnected; inner.OnServerError = OnServerError;