Skip to content

Commit

Permalink
core:autopilot_manager: Fix race setting router
Browse files Browse the repository at this point in the history
* Change to use stop and start since directlly changing the router
  without modifying should_be_running can cause multiple starts
  • Loading branch information
JoaoMario109 committed Sep 30, 2024
1 parent a436170 commit f800b53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/services/ardupilot_manager/mavlink_proxy/Manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ async def set_preferred_router(self, router_name: str) -> None:
try:
endpoints = self.endpoints()
master_endpoint = self.master_endpoint
await self.tool.exit()
await self.stop()
self.tool = AbstractRouter.get_interface(router_name)()
for endpoint in endpoints:
self.tool.add_endpoint(endpoint)
if master_endpoint:
await self.tool.start(master_endpoint)
await self.start(master_endpoint)
except Exception as error:
logger.error(f"Failed to set preferred router to {router_name}. {error}")

Expand Down

0 comments on commit f800b53

Please sign in to comment.