Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router: track endpoints more explicitly #19554

Merged

Commits on Nov 9, 2023

  1. router: explicitly track endpoints

    The router currently keeps a mapping of open channels to the endpoints
    responsible for them.  This presents two problems:
    
     - when we close down an endpoint, we need to iterate all open channels
       in order to determine which channels belong to that endpoint
     - it's possible to have active endpoints associated with the router
       which the router has no idea about
    
    Move to a more explicit model where we add a second mapping: endpoints
    to their set of open channels.  This makes endpoint shutdown easier and
    adds the advantage that an endpoint with no channels can still be
    tracked by the router (with an empty channel list).
    
    The second point of this will be useful in future commits when the
    router (and not the routing rules) become responsible for ensuring that
    all endpoints are correctly shutdown.
    
    We need to adjust the beiboot code a bit to avoid a catch22 whereby the
    routing rule needs to exist before the router is initialized, but the
    Peer itself can only now exist after the router is initialized.
    allisonkarlitskaya committed Nov 9, 2023
    Configuration menu
    Copy the full SHA
    27ea594 View commit details
    Browse the repository at this point in the history
  2. dbus channel: make 'close' message idempotent

    It's theoretically possible that the user might send multiple 'close'
    messages to a D-Bus channel, which would have a chance to be delivered
    because the channel doesn't close immediately (but rather waits for
    outstanding requests to complete).
    
    This is a pretty theoretical bug but it's going to get worse when we
    modify how the router shutdown works in the next commit.
    allisonkarlitskaya committed Nov 9, 2023
    Configuration menu
    Copy the full SHA
    e05a203 View commit details
    Browse the repository at this point in the history
  3. router: shutdown via endpoints, not channels

    Add a .do_close() virtual method at the Endpoint level.  This is already
    implemented by Channel, but let's also add an implementation of it to
    Peer which shuts down the Peer in the usual way.
    
    When the bridge gets EOF we can now call this method on all endpoints
    instead of creating synthetic close messages for each channel.  We also
    stop tracking open channels for knowing when the shutdown is complete,
    and track endpoints instead (which is a strictly tighter constraint, as
    it includes endpoints with no open channels).
    
    There's the small matter of the increasingly redundant shutdown() method
    on routing rules, but we can clean that up soon.
    allisonkarlitskaya committed Nov 9, 2023
    Configuration menu
    Copy the full SHA
    e7eb12d View commit details
    Browse the repository at this point in the history