Fix race condition, ignore errors when sending measurements and reading control
This commit is contained in:
parent
367fb6f284
commit
8c65896c65
|
@ -121,17 +121,18 @@ void FServerGameController::Tick(float DeltaSeconds)
|
|||
|
||||
// Send measurements.
|
||||
{
|
||||
if(CarlaSettings->bSynchronousMode)
|
||||
{
|
||||
FlushRenderingCommands();
|
||||
}
|
||||
if (CarlaSettings->bSynchronousMode)
|
||||
{
|
||||
FlushRenderingCommands();
|
||||
}
|
||||
|
||||
if (Errc::Error == Server->SendMeasurements(
|
||||
DataRouter.GetPlayerState(),
|
||||
DataRouter.GetAgents(),
|
||||
CarlaSettings->bSendNonPlayerAgentsInfo))
|
||||
{
|
||||
Server = nullptr;
|
||||
{
|
||||
// The error here must be ignored, otherwise we can create a race
|
||||
// condition between the different ports.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -140,12 +141,10 @@ void FServerGameController::Tick(float DeltaSeconds)
|
|||
{
|
||||
const bool bShouldBlock = CarlaSettings->bSynchronousMode;
|
||||
FVehicleControl Control;
|
||||
if (Errc::Error == Server->ReadControl(Control, bShouldBlock)) {
|
||||
Server = nullptr;
|
||||
return;
|
||||
} else {
|
||||
if (Errc::Error != Server->ReadControl(Control, bShouldBlock))
|
||||
{
|
||||
DataRouter.ApplyVehicleControl(Control);
|
||||
}
|
||||
} // Here we ignore the error too.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue