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

server: Use server peer in log statements. #3202

Merged
merged 4 commits into from
Oct 30, 2023

Commits on Oct 28, 2023

  1. netsync: Rename NewPeer to PeerConnected.

    This renames the NewPeer method to PeerConnected to more clearly denote
    its purpose.  It also renames some of the internal plumbing to match.
    davecgh committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    0064181 View commit details
    Browse the repository at this point in the history
  2. netsync: Rename DonePeer to PeerDisconnected.

    This renames the DonePeer method to PeerDisconnected to more clearly
    denote its purpose.  It also renames some of the internal plumbing to
    match.
    davecgh committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    a3698da View commit details
    Browse the repository at this point in the history
  3. netsync: Export opaque peer and require it in API.

    Currently the sync manager maintains additional state per peer in an
    internal struct that wraps a base/common peer as well as a mapping keyed
    by that base/common peer.  The internal wrapped peer is then queried
    each time it is needed.  This leads to code that is harder to reason
    about and can fail to lookup the necessary state in some hard to hit
    corner cases.
    
    With that in mind, this modifies the sync manager semantics to instead
    export the wrapped peer and require the caller to provide that wrapped
    peer in all of its APIs directly.  The server then creates and stores
    the wrapped peer instance at connection time and passes it to the sync
    manager.
    
    The end result is the code is easier to reason about and resolves the
    aforementioned hard to hit corner cases since it is no longer possible
    for the sync manager to ever have access to a peer without the
    associated extra state.
    davecgh committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    517091c View commit details
    Browse the repository at this point in the history
  4. server: Use server peer in log statements.

    This change a few cases that log the peer to use the server peer instead
    of the underlying peer from the peer package.  This doesn't change the
    output in any way, but it is more consistent with the vast majority of
    other instances.  It also preferable since it ensures consistent logging
    output if a custom stringer is ever implemented on server peers.
    davecgh committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    b60de60 View commit details
    Browse the repository at this point in the history