This issue concerns the drive_route function as present starting on line 107 in file server/src/handler_driver.c.
The loop commented with "// Wait until the next segment is entered" (Line 152) can only ever be exited if the server is being shut down or if the train enters one particular 'next' segment (path_item). When driving in practice, the train is sometimes lost or recognized as a different train for a few seconds. If the train passes over the expected next segment during this time, the loop will never be exited (until shutdown).
Outline for possible solution: Check for entering of any segments still "left" on the route. If a segment further ahead is entered, skip looking for the current segment. Note: This must be implemented with routes in mind that can enter the same segment twice along a route.
This issue concerns the drive_route function as present starting on line 107 in file server/src/handler_driver.c.
The loop commented with "// Wait until the next segment is entered" (Line 152) can only ever be exited if the server is being shut down or if the train enters one particular 'next' segment (path_item). When driving in practice, the train is sometimes lost or recognized as a different train for a few seconds. If the train passes over the expected next segment during this time, the loop will never be exited (until shutdown).
Outline for possible solution: Check for entering of any segments still "left" on the route. If a segment further ahead is entered, skip looking for the current segment. Note: This must be implemented with routes in mind that can enter the same segment twice along a route.