mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 10:14:14 +00:00
use SetTransportError
This commit is contained in:
parent
9da4282d47
commit
59ff8f56ff
@ -66,6 +66,7 @@ namespace EpicTransport
|
|||||||
|
|
||||||
if (await Task.WhenAny(connectedCompleteTask, Task.Delay(ConnectionTimeout /*, cancelToken.Token*/)) != connectedCompleteTask)
|
if (await Task.WhenAny(connectedCompleteTask, Task.Delay(ConnectionTimeout /*, cancelToken.Token*/)) != connectedCompleteTask)
|
||||||
{
|
{
|
||||||
|
SetTransportError($"Connection to {host} timed out.");
|
||||||
Debug.LogError($"Connection to {host} timed out.");
|
Debug.LogError($"Connection to {host} timed out.");
|
||||||
OnConnected -= SetConnectedComplete;
|
OnConnected -= SetConnectedComplete;
|
||||||
OnConnectionFailed(hostProductId);
|
OnConnectionFailed(hostProductId);
|
||||||
@ -75,12 +76,14 @@ namespace EpicTransport
|
|||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
|
SetTransportError("Connection string was not in the right format. Did you enter a ProductId?");
|
||||||
Debug.LogError($"Connection string was not in the right format. Did you enter a ProductId?");
|
Debug.LogError($"Connection string was not in the right format. Did you enter a ProductId?");
|
||||||
Error = true;
|
Error = true;
|
||||||
OnConnectionFailed(hostProductId);
|
OnConnectionFailed(hostProductId);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
SetTransportError(ex.Message);
|
||||||
Debug.LogError(ex.Message);
|
Debug.LogError(ex.Message);
|
||||||
Error = true;
|
Error = true;
|
||||||
OnConnectionFailed(hostProductId);
|
OnConnectionFailed(hostProductId);
|
||||||
@ -177,6 +180,7 @@ namespace EpicTransport
|
|||||||
Debug.Log("Connection established.");
|
Debug.Log("Connection established.");
|
||||||
break;
|
break;
|
||||||
case InternalMessages.DISCONNECT:
|
case InternalMessages.DISCONNECT:
|
||||||
|
SetTransportError("host disconnected");
|
||||||
Connected = false;
|
Connected = false;
|
||||||
Debug.Log("Disconnected.");
|
Debug.Log("Disconnected.");
|
||||||
|
|
||||||
@ -191,6 +195,10 @@ namespace EpicTransport
|
|||||||
public void Send(byte[] data, int channelId) => Send(hostProductId, socketId, data, (byte)channelId);
|
public void Send(byte[] data, int channelId) => Send(hostProductId, socketId, data, (byte)channelId);
|
||||||
|
|
||||||
protected override void OnConnectionFailed(ProductUserId remoteId) => OnDisconnected.Invoke();
|
protected override void OnConnectionFailed(ProductUserId remoteId) => OnDisconnected.Invoke();
|
||||||
public void EosNotInitialized() => OnDisconnected.Invoke();
|
public void EosNotInitialized()
|
||||||
|
{
|
||||||
|
SetTransportError("EOS not initialized");
|
||||||
|
OnDisconnected.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user