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

Listener removes wrong guy #645

Merged
merged 2 commits into from Sep 23, 2020
Merged

Listener removes wrong guy #645

merged 2 commits into from Sep 23, 2020

Commits on Sep 23, 2020

  1. Always remove the right listener from the hub

    When in hubs.trampoline(fd, ...), a greenthread registers itself as a
    listener for fd, switches to the hub, and then calls
    hub.remove(listener) to deregister itself. hub.remove(listener)
    removes the primary listener. If the greenthread awoke because its fd
    became ready, then it is the primary listener, and everything is
    fine. However, if the greenthread was a secondary listener and awoke
    because a Timeout fired then it would remove the primary and promote a
    random secondary to primary.
    
    This commit makes hub.remove(listener) check to make sure listener is
    the primary, and if it's not, remove the listener from the
    secondaries.
    smerritt authored and clayg committed Sep 23, 2020
    Copy the full SHA
    9f49f0b View commit details
    Browse the repository at this point in the history
  2. Make remove more explicit

    There was some concern in fixing hub.remove for secondary listeners
    because tests seemed to rely on the implicit robustness of hub.remove
    when a listener wasn't being tracked.
    
    It was discovered that socket errors can bubble up in poll and select
    hubs which result in all listeners being removed for that fileno before
    the listener was alerted (which would then *also* triggered a remove).
    
    Rather than having remove be robust to being called twice this change
    makes it be called only once.
    clayg committed Sep 23, 2020
    Copy the full SHA
    af253ad View commit details
    Browse the repository at this point in the history