-
Notifications
You must be signed in to change notification settings - Fork 115
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
Initial tower-based peer implementation. #17
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d5769b4
to
93140cb
Compare
Note: I threw away the old branch and force-pushed a new one on top of it. |
Unfortunately the generic `failure::Error` type is not `Clone` because of its internals: rust-lang-deprecated/failure#148 The fix is to either switch to `Rc<Error>` or `Arc<Error>`, or to use a custom `Fail` type. In this case using a custom `Fail` might be best but this commit just stubs out references to e.clone() until then.
dconnolly
reviewed
Oct 3, 2019
dconnolly
reviewed
Oct 3, 2019
failure::Error isn't Clone, so we wrap it in a cloneable handle and use that everywhere. Also, remove the error from ServerState::Failed, because it's already held in the error_slot.
fd2637a
to
d0a0dcd
Compare
This required rearranging the PeerServer internals so that instead of sending a response along a channel to the PeerClient, the PeerClient creates a oneshot channel whose tx end is sent to the PeerServer and whose rx end is owned by the <PeerClient as Service>::Future.
We need to be able to convert the errors returned by the tower_buffer::Buffer service handle into failure::Errors, but in order to test that any of this works we can ignore that for now.
d0a0dcd
to
d5601fe
Compare
We want the PeerServer to be generic over the kind of stream that it has, so that the PeerConnector can use stream combinators to add hooks into the streams that it constructs (e.g., to fire last-seen timestamps). A more natural design would be for the PeerServer struct to own both tx and rx halves of the message stream, but this complicates the borrow checker (since the main event loop needs to hold a future that controls rx, it cannot allow something else to have mutable access to rx, so if the rx end is part of self, it cannot make &mut self calls).
Marking this as "ready for review" even though there's still a lot of cleanup to be done, but it does actually "technically work" now. |
619d377
to
b483826
Compare
dconnolly
approved these changes
Oct 7, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed via videochat. LGTM pending green build 🚀
chelseakomlo
reviewed
Oct 7, 2019
chelseakomlo
reviewed
Oct 7, 2019
chelseakomlo
reviewed
Oct 7, 2019
chelseakomlo
reviewed
Oct 7, 2019
This was referenced Oct 7, 2019
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scratch work towards having a request/response-oriented
Peer
service. Branch is on top of #16.