NetworkServerTest: RemoveLocalConnection reuses CreateLocalConnectionPair

This commit is contained in:
vis2k 2021-06-15 16:44:31 +08:00
parent 133b1eb841
commit bf6957c150

View File

@ -241,11 +241,8 @@ public void RemoveLocalConnection()
NetworkServer.Listen(1);
// set local connection
// local connection needs a server connection because
// RemoveLocalConnection calls localConnection.Disconnect
LocalConnectionToClient localConnection = new LocalConnectionToClient();
localConnection.connectionToServer = new LocalConnectionToServer();
NetworkServer.SetLocalConnection(localConnection);
CreateLocalConnectionPair(out LocalConnectionToClient connectionToClient, out _);
NetworkServer.SetLocalConnection(connectionToClient);
// remove local connection
NetworkServer.RemoveLocalConnection();