Skip to content

Refactor router#2105

Open
vooon wants to merge 9 commits intoros2from
refactor-router
Open

Refactor router#2105
vooon wants to merge 9 commits intoros2from
refactor-router

Conversation

@vooon
Copy link
Member

@vooon vooon commented Feb 15, 2026

Summary

Refactors router internals for lower lock contention and better runtime efficiency, and switches MAVConn endpoints to a shared ASIO io_service.

Changes

  • Reduced lock hold time in router message path:
    • no send operations under router map lock
    • removed goto-style retry flow in routing logic
  • Reduced lock hold time in endpoint management:
    • add_endpoint()/del_endpoint() avoid open/close work under router lock
  • C++20 cleanup in router:
    • replaced std::bind callbacks with lambdas
    • switched std::shared_timed_mutex -> std::shared_mutex
  • Shared IO integration:
    • router now owns a shared mavconn::IoContextRunner
    • all MAVConnEndpoint instances use router shared io_service
    • clean shared IO shutdown in Router destructor

Validation

  • Built mavros from /ws
  • Ran mavros-router-test
  • Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant