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); NetworkServer.Listen(1);
// set local connection // set local connection
// local connection needs a server connection because CreateLocalConnectionPair(out LocalConnectionToClient connectionToClient, out _);
// RemoveLocalConnection calls localConnection.Disconnect NetworkServer.SetLocalConnection(connectionToClient);
LocalConnectionToClient localConnection = new LocalConnectionToClient();
localConnection.connectionToServer = new LocalConnectionToServer();
NetworkServer.SetLocalConnection(localConnection);
// remove local connection // remove local connection
NetworkServer.RemoveLocalConnection(); NetworkServer.RemoveLocalConnection();