Repository navigation
Conversation
Convert UdpSocket's async methods to tower-style named associated futures so each future's Send-ness is structural and boundable at the use site, and drop the blanket Send + Sync from the trait. First slice of the embedded/no_std named-futures rollout (TcpStream/TcpListener follow); unblocks a future embassy-net (!Send) backend. - The 8 async methods return named GAT futures (Bind/Connect/Recv/RecvFrom/ Send/SendTo/Peek/PeekFrom). The I/O futures are zero-cost wrappers over the poll primitives; bind/connect/send_to are pin-projected state machines that hold ToSocketAddrs' own named resolution future -- no Box, no nightly TAIT. - Add poll_send (connected send; a plain `send` avoids EISCONN on BSD/macOS where `sendto` on a connected socket fails) and poll_peek_from primitives. - bind: std bind (non-blocking) + TryFrom; connect: socket2's sync UDP connect. - The relaxed Send + Sync surfaces only at genuine use sites: hickory's DnsUdpSocket / RuntimeProvider impls (agnostic-dns) and the UDP test spawn sites carry explicit `where N::UdpSocket: Send + Sync` bounds. BREAKING CHANGE: UdpSocket's async methods return named future types instead of `impl Future + Send`, and the trait no longer requires Send + Sync. Generic code that spawns a socket on a multi-threaded executor must add an explicit Send bound.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
==========================================
+ Coverage 52.82% 55.30% +2.47%
==========================================
Files 42 42
Lines 1861 2094 +233
==========================================
+ Hits 983 1158 +175
- Misses 878 936 +58
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
The always-compiled Bind/Connect/SendTo futures use pin-project-lite, so make it an unconditional dependency (it was optional, pulled only by tokio/smol). The future constructors are called only from the runtime-backend macro, so gate them behind `any(feature = "tokio", feature = "smol")` to avoid a dead-code error under `--no-default-features` (the crate denies warnings).
… and TcpListener
Apply the tower-style named-future conversion to TcpStream, TcpListener,
OwnedReadHalf, OwnedWriteHalf, and ReuniteError: every async method returns a
named future, and Send + Sync is dropped from the traits' supertraits and from
the method futures/streams (boundable at the use site instead).
- New named-future associated types: TcpStream::{Connect, ConnectTimeout, Peek},
TcpListener::{Bind, Accept, Incoming, IntoIncoming}, OwnedReadHalf::Peek.
- New poll primitives: TcpStream::{poll_peek, poll_write_ready},
TcpListener::poll_accept, OwnedReadHalf::poll_peek.
- connect is a non-blocking-connect state machine (socket2 + set_nonblocking +
tolerate EINPROGRESS via the existing rustix dep, then poll_write_ready +
take_error) -- zero-cost on stable. bind reuses the sync std-bind + TryFrom.
- Future types are namespaced under `agnostic_net::{udp,tcp}::*` (the traits
stay at the crate root) to avoid the Bind/Connect/Peek name collision.
- The relaxed Send + Sync surfaces only at the use sites: hickory's DnsTcpStream
/ RuntimeProvider impls (agnostic-dns) and the TCP test spawn sites carry
explicit `where N::TcpStream: Send + Sync` bounds.
BREAKING CHANGE: TcpStream/TcpListener async methods return named future types
instead of `impl Future + Send`, the traits no longer require Send + Sync, and
the UDP/TCP future types moved from the crate root into the `udp`/`tcp` modules.
This file contains hidden or 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
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.
No description provided.