Now we can stop even while connecting.

In some transports (Ignorance),  when the player clicks "Connect",   the transport goes in Connecting state. If the player clicks Disconnect
the transport remains in Connecting state.

This gives the transport a chance to cancel the Connecting process.  This fix has been tested for quite some time in 2018 branch
This commit is contained in:
Paul Pacheco 2019-01-29 19:05:38 -06:00
parent 6c163d1a45
commit 1b915fbffb

View File

@ -72,14 +72,13 @@ public void Disconnect()
// (might be client or host mode here)
isReady = false;
ClientScene.HandleClientDisconnect(this);
// paul: we may be connecting or connected, either way, we need to disconnect
// transport should not do anything if it is not connecting/connected
NetworkManager.singleton.transport.ClientDisconnect();
// client? then stop transport
if (NetworkManager.singleton.transport.ClientConnected())
{
NetworkManager.singleton.transport.ClientDisconnect();
}
// server? then disconnect that client
else if (NetworkManager.singleton.transport.ServerActive())
if (NetworkManager.singleton.transport.ServerActive())
{
NetworkManager.singleton.transport.ServerDisconnect(connectionId);
}