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

Add high level async protocol interface #69

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

nyonson
Copy link
Collaborator

@nyonson nyonson commented Oct 1, 2024

Add the AsyncProtocol wrapper interface for easy protocol setup, sending, and receiving.

  • Feature flag gated with the new async flag.
  • Example usage in the proxy crate. Makes the proxy code super simple.
  • We are using futures-rs for the general AsyncRead and AsyncWrite traits to code the wrapper against. The Only annoying thing at the moment is the necessary "compat" util to convert Tokio futures to futures-rs futures in proxy, but I am not sure if there is a better way with all the different future traits.

Tests

  • Tested the proxy update with Nakamoto.

Minor Cleanup

  • Moved the split_garbage function into the Handshake so that it can just implicitly use the remote terminator. Also makes more organizational sense to me.
  • Using default implementations for impl std::error::Error for Error {} since we were essentially duplicating the default implementation of source().

@nyonson nyonson force-pushed the add-async-protocol branch 5 times, most recently from ab64217 to abe22e8 Compare October 1, 2024 21:53
@nyonson nyonson marked this pull request as ready for review October 2, 2024 16:03
@nyonson nyonson force-pushed the add-async-protocol branch 2 times, most recently from caf645f to 9f43bce Compare October 2, 2024 16:26
protocol/src/lib.rs Outdated Show resolved Hide resolved
@nyonson nyonson force-pushed the add-async-protocol branch 2 times, most recently from 6de7142 to 5e5fa05 Compare October 2, 2024 17:59
@rustaceanrob
Copy link
Collaborator

rustaceanrob commented Oct 2, 2024

I think these all fall under the first commit if you could squash. Otherwise LGTM

And good find for the extension traits

@nyonson nyonson force-pushed the add-async-protocol branch from 5e5fa05 to dffeef5 Compare October 2, 2024 18:08
@rustaceanrob
Copy link
Collaborator

ACK dffeef5

@rustaceanrob rustaceanrob merged commit 1a393b0 into rust-bitcoin:main Oct 2, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants