NetworkClient.ConnectHost: local connection setup moved into a separate function

This commit is contained in:
vis2k 2022-12-12 13:53:07 +01:00
parent 1b7906c1ed
commit e0ffc66be8

View File

@ -212,14 +212,10 @@ public static void Connect(Uri uri)
connection = new NetworkConnectionToServer();
}
// TODO why are there two connect host methods?
// called from NetworkManager.FinishStartHost()
public static void ConnectHost()
// keep the local connections setup in one function.
// makes host setup easier to follow.
internal static void SetupHostConnections()
{
Initialize(true);
connectState = ConnectState.Connected;
// create local connections pair, both are connected
Utils.CreateLocalConnections(
out LocalConnectionToClient connectionToClient,
@ -231,6 +227,15 @@ public static void ConnectHost()
NetworkServer.SetLocalConnection(connectionToClient);
}
// TODO why are there two connect host methods?
// called from NetworkManager.FinishStartHost()
public static void ConnectHost()
{
Initialize(true);
connectState = ConnectState.Connected;
SetupHostConnections();
}
/// <summary>Connect host mode</summary>
// called from NetworkManager.FinishStartHostClient
// TODO why are there two connect host methods?