Skip to content

Commit

Permalink
fix error reporting from bridge client
Browse files Browse the repository at this point in the history
  • Loading branch information
heeen authored and lokesku committed Aug 13, 2021
1 parent d15b778 commit e1f4177
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Assets/Scripts/Components/BridgeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Connect(string connection)
}

Connection = connection;
ConnectTime = 0;
ConnectTime = Stopwatch.GetTimestamp();
}

public void Update()
Expand All @@ -64,32 +64,32 @@ public void Update()
return;
}

// do not reconnect in non interactive mode
// do not reconnect in simulation error state
// do not reconnect in simulation stopping state
if (BridgeStatus == Status.UnexpectedlyDisconnected &&
( Loader.Instance.CurrentSimulation.Interactive == false
|| Loader.Instance.Status == SimulatorStatus.Error
(Loader.Instance.Status == SimulatorStatus.Error
|| Loader.Instance.Status == SimulatorStatus.Stopping))
{
Bridge.Disconnect();
Disconnected = true;
}
// do not reconnect in non interactive mode and report error
else if (BridgeStatus == Status.UnexpectedlyDisconnected &&
Loader.Instance.CurrentSimulation.Interactive == false)
{
Loader.Instance.reportStatus(SimulatorStatus.Error, "Bridge socket was unexpectedly disconnected");
Bridge.Disconnect();
Disconnected = true;
}
else if (disconnectedStatus)
{
if (Stopwatch.GetTimestamp() > ConnectTime || ConnectTime == 0 || Time.timeScale == 0f)
if (Stopwatch.GetTimestamp() >= ConnectTime)
{
Disconnected = false;
Bridge.Connect(Connection);
}
else
{
return;
}
}

if (BridgeStatus == Status.Connected)
else if (BridgeStatus == Status.Connected)
{
Bridge.Update();
}
Expand Down

0 comments on commit e1f4177

Please sign in to comment.