apple / swift-cluster-membership

Distributed Membership Protocol implementations in Swift
https://apple.github.io/swift-cluster-membership/
Apache License 2.0
201 stars 20 forks source link

SWIMNIO: Small cleanup: Move callback handling into Shell from Handler #41

Open ktoso opened 4 years ago

ktoso commented 4 years ago

Currently we manage the callbacks in the SWIMNIOHandler, they're keyed by sequencenumbers which are invoked when we get "replies" since of course there's no such thing as a "reply" in UDP itself so we emulate them this way.

This could sit in the Shell rather than in the Handler which should only do serialization and message dispatch really.

// TODO: move callbacks into the shell?
    struct PendingResponseCallbackIdentifier: Hashable {
        let peerAddress: SocketAddress // FIXME: UID as well...?
        let sequenceNumber: SWIM.SequenceNumber
    }

Small ticket to be picked up by someone interested I think