Merge pull request #299 from carla-simulator/issue#297
Fix race condition
This commit is contained in:
commit
486d1873db
|
@ -121,7 +121,7 @@ void FServerGameController::Tick(float DeltaSeconds)
|
||||||
|
|
||||||
// Send measurements.
|
// Send measurements.
|
||||||
{
|
{
|
||||||
if(CarlaSettings->bSynchronousMode)
|
if (CarlaSettings->bSynchronousMode)
|
||||||
{
|
{
|
||||||
FlushRenderingCommands();
|
FlushRenderingCommands();
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,8 @@ void FServerGameController::Tick(float DeltaSeconds)
|
||||||
DataRouter.GetAgents(),
|
DataRouter.GetAgents(),
|
||||||
CarlaSettings->bSendNonPlayerAgentsInfo))
|
CarlaSettings->bSendNonPlayerAgentsInfo))
|
||||||
{
|
{
|
||||||
Server = nullptr;
|
// The error here must be ignored, otherwise we can create a race
|
||||||
|
// condition between the different ports.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,12 +141,10 @@ void FServerGameController::Tick(float DeltaSeconds)
|
||||||
{
|
{
|
||||||
const bool bShouldBlock = CarlaSettings->bSynchronousMode;
|
const bool bShouldBlock = CarlaSettings->bSynchronousMode;
|
||||||
FVehicleControl Control;
|
FVehicleControl Control;
|
||||||
if (Errc::Error == Server->ReadControl(Control, bShouldBlock)) {
|
if (Errc::Error != Server->ReadControl(Control, bShouldBlock))
|
||||||
Server = nullptr;
|
{
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
DataRouter.ApplyVehicleControl(Control);
|
DataRouter.ApplyVehicleControl(Control);
|
||||||
}
|
} // Here we ignore the error too.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue