NetworkServer.OnConnected: call AddConnection in here too, instead of manually doing it from AddLocalClient and OnConnected

This commit is contained in:
vis2k 2019-02-26 15:13:04 +01:00
parent fd561db9c2
commit 9957cbc3b5

View File

@ -141,7 +141,6 @@ internal static int AddLocalClient(LocalClient localClient)
{
connectionId = 0
};
AddConnection(s_LocalConnection);
OnConnected(s_LocalConnection);
return 0;
}
@ -323,7 +322,6 @@ static void OnConnected(int connectionId)
// add player info
NetworkConnection conn = new NetworkConnection(address, serverHostId, connectionId);
AddConnection(conn);
OnConnected(conn);
}
else
@ -337,6 +335,9 @@ static void OnConnected(int connectionId)
static void OnConnected(NetworkConnection conn)
{
if (LogFilter.Debug) { Debug.Log("Server accepted client:" + conn.connectionId); }
// add connection and invoke connected event
AddConnection(conn);
conn.InvokeHandlerNoData((short)MsgType.Connect);
}