Skip to content

Commit

Permalink
fix: calling Connect and Authenticate handler twice (#102)
Browse files Browse the repository at this point in the history
* Do not register Connect handler twice

* fix tests

* Don't let the manager auto start on github
  • Loading branch information
paulpach committed Mar 22, 2020
1 parent 7e53d7e commit 515f5a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion Assets/Mirror/Runtime/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ internal void ConnectHost(NetworkServer server)
if (LogFilter.Debug) Debug.Log("Client Connect Host to Server");

RegisterSystemHandlers(true);
InitializeAuthEvents();

connectState = ConnectState.Connected;

Expand Down
13 changes: 9 additions & 4 deletions Assets/Mirror/Tests/Play/HostTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using NUnit.Framework;
using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;

namespace Mirror.Tests
{
Expand All @@ -19,18 +21,21 @@ public class HostTests<T> where T:NetworkBehaviour
protected NetworkIdentity identity;
protected T component;

[SetUp]
public void SetupHost()
[UnitySetUp]
public IEnumerator SetupHost()
{
networkManagerGo = new GameObject();
manager = networkManagerGo.AddComponent<NetworkManager>();
manager.client = networkManagerGo.GetComponent<NetworkClient>();
manager.server = networkManagerGo.GetComponent<NetworkServer>();
server = manager.server;
client = manager.client;

manager.startOnHeadless = false;
manager.autoCreatePlayer = false;

// wait for manager to Start()
yield return null;

manager.StartHost();

playerGO = new GameObject();
Expand Down

0 comments on commit 515f5a1

Please sign in to comment.