Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 64 additions & 1 deletion tokio/src/net/unix/datagram/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use crate::util::check_socket_for_blocking;
use std::fmt;
use std::io;
use std::net::Shutdown;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::unix::ffi::OsStrExt;
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
use std::os::unix::net;
use std::path::Path;
Expand Down Expand Up @@ -396,7 +398,8 @@ impl UnixDatagram {
where
P: AsRef<Path>,
{
let socket = mio::net::UnixDatagram::bind(path)?;
let addr = SocketAddr::from_path(path)?.0;
let socket = mio::net::UnixDatagram::bind_addr(&addr)?;
UnixDatagram::new(socket)
}

Expand Down Expand Up @@ -571,6 +574,11 @@ impl UnixDatagram {
/// The `send` method may be used to send data to the specified address.
/// `recv` and `recv_from` will only receive data from that address.
///
/// # Limitations
///
/// This method currently does not allow specifying Linux abstract
/// namespace paths.
Comment on lines +577 to +580
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

The limitation docs should mention Android too.

The runtime checks for abstract paths are gated with cfg(any(target_os = "linux", target_os = "android")) at Lines 618-624, 761-767, 1145-1151, and 1283-1289, so the current "Linux abstract namespace paths" wording is incorrect on Android across all four methods.

Also applies to: 715-718, 1102-1105, 1256-1259

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tokio/src/net/unix/datagram/socket.rs` around lines 577 - 580, The docs
incorrectly state "Linux abstract namespace paths" while the runtime checks also
include Android; update the doc comments that currently read "This method
currently does not allow specifying Linux abstract namespace paths." (and the
similar occurrences at the other locations) to mention Android as well — e.g.
"Linux and Android abstract namespace paths" or "Linux/Android abstract
namespace paths"; make this change for all four methods where the runtime checks
use cfg(any(target_os = "linux", target_os = "android")) (and the additional
occurrences you noted) so the documentation matches the actual cfg-gated
behavior.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The CodeRabbit AI reviewer is correct! The method is available for both Linux and Android (Android is based on Linux but still there are differences), so the documentation should be more explicit that Android is also supported.

///
/// # Examples
/// ```
/// # use std::error::Error;
Expand Down Expand Up @@ -605,6 +613,16 @@ impl UnixDatagram {
/// # }
/// ```
pub fn connect<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
//FIXME: Convert this to `mio::net::UnixDatagram::connect_addr` once
// that is supported by MIO
#[cfg(any(target_os = "linux", target_os = "android"))]
if path.as_ref().as_os_str().as_bytes().starts_with(b"\0") {
return Err(io::Error::new(
io::ErrorKind::Other,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and to provide a more descriptive error, it would be better to use io::ErrorKind::InvalidInput here instead of io::ErrorKind::Other. This indicates that the input path type (abstract socket) is not valid for this operation. The new test recv_abstract also expects InvalidInput for a similar case on non-Linux platforms.

Suggested change
io::ErrorKind::Other,
io::ErrorKind::InvalidInput,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Gemini AI reviewer is correct! Since some UDP related methods do not support abstract paths it would be better to return an InvalidInput kind of error to better tell the caller what is the issue.

"UnixDatagram::connect(): abstract paths currently unsupported",
));
}

self.io.connect(path)
}

Expand Down Expand Up @@ -694,6 +712,11 @@ impl UnixDatagram {

/// Tries to send a datagram to the peer without waiting.
///
/// # Limitations
///
/// This method currently does not allow specifying Linux abstract
/// namespace paths.
///
/// # Examples
///
/// ```no_run
Expand Down Expand Up @@ -733,6 +756,16 @@ impl UnixDatagram {
where
P: AsRef<Path>,
{
//FIXME: Convert this to `mio::net::UnixDatagram::send_to_addr` once
// that is supported by MIO
#[cfg(any(target_os = "linux", target_os = "android"))]
if target.as_ref().as_os_str().as_bytes().starts_with(b"\0") {
return Err(io::Error::new(
io::ErrorKind::Other,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to other functions in this file, it would be better to use io::ErrorKind::InvalidInput here instead of io::ErrorKind::Other to provide a more specific error when an unsupported path type is used.

Suggested change
io::ErrorKind::Other,
io::ErrorKind::InvalidInput,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Gemini AI reviewer is correct! Since some UDP related methods do not support abstract paths it would be better to return an InvalidInput kind of error to better tell the caller what is the issue.

"UnixDatagram::try_send_to(): abstract paths currently unsupported",
));
}

self.io
.registration()
.try_io(Interest::WRITABLE, || self.io.send_to(buf, target))
Expand Down Expand Up @@ -1066,6 +1099,11 @@ impl UnixDatagram {
/// [`tokio::select!`](crate::select) statement and some other branch
/// completes first, then it is guaranteed that the message was not sent.
///
/// # Limitations
///
/// This method currently does not allow specifying Linux abstract
/// namespace paths.
///
/// # Examples
/// ```
/// # use std::error::Error;
Expand Down Expand Up @@ -1102,6 +1140,16 @@ impl UnixDatagram {
where
P: AsRef<Path>,
{
//FIXME: Convert this to `mio::net::UnixDatagram::send_to_addr` once
// that is supported by MIO
#[cfg(any(target_os = "linux", target_os = "android"))]
if target.as_ref().as_os_str().as_bytes().starts_with(b"\0") {
return Err(io::Error::new(
io::ErrorKind::Other,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To be consistent with other error handling in this file and provide a more descriptive error, please consider using io::ErrorKind::InvalidInput instead of io::ErrorKind::Other.

Suggested change
io::ErrorKind::Other,
io::ErrorKind::InvalidInput,

Copy link
Copy Markdown
Owner Author

@martin-augment martin-augment Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Gemini AI reviewer is correct! Since some UDP related methods do not support abstract paths it would be better to return an InvalidInput kind of error to better tell the caller what is the issue.

"UnixDatagram::send_to(): abstract paths currently unsupported",
));
}

self.io
.registration()
.async_io(Interest::WRITABLE, || self.io.send_to(buf, target.as_ref()))
Expand Down Expand Up @@ -1205,6 +1253,11 @@ impl UnixDatagram {
/// `Waker` from the `Context` passed to the most recent call will be scheduled to
/// receive a wakeup.
///
/// # Limitations
///
/// This method currently does not allow specifying Linux abstract
/// namespace paths.
///
/// # Return value
///
/// The function returns:
Expand All @@ -1225,6 +1278,16 @@ impl UnixDatagram {
where
P: AsRef<Path>,
{
//FIXME: Convert this to `mio::net::UnixDatagram::send_to_addr` once
// that is supported by MIO
#[cfg(any(target_os = "linux", target_os = "android"))]
if target.as_ref().as_os_str().as_bytes().starts_with(b"\0") {
return Poll::Ready(Err(io::Error::new(
io::ErrorKind::Other,
"UnixDatagram::send_to(): abstract paths currently unsupported",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In poll_send_to, the error string says UnixDatagram::send_to() even though the check is in poll_send_to, which could be confusing when diagnosing failures from this API.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Augment AI reviewer is correct! The error message is copy/pasted from another method and the method name is still mentioning the source of the copy. The method name should be updated to "poll_send_to()" to avoid confusion in the developer debugging an issue.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message references wrong method name in poll_send_to

Low Severity

The error message in poll_send_to says "UnixDatagram::send_to()" instead of "UnixDatagram::poll_send_to()". All other methods in this file include the correct method name in their error messages (connectconnect(), try_send_totry_send_to()), so this appears to be a copy-paste oversight that could confuse users debugging the error.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Bugbot AI reviewer is correct! The error message is copy/pasted from another method and the method name is still mentioning the source of the copy. The method name should be updated to "poll_send_to()" to avoid confusion in the developer debugging an issue.

)));
Comment on lines +1285 to +1288
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are two small issues here:

  • The error message refers to UnixDatagram::send_to(), but this function is poll_send_to(). The message should be updated to reflect the correct function name.
  • For consistency, it would be better to use io::ErrorKind::InvalidInput instead of io::ErrorKind::Other to indicate that abstract socket paths are not a valid input for this function at this time.
Suggested change
return Poll::Ready(Err(io::Error::new(
io::ErrorKind::Other,
"UnixDatagram::send_to(): abstract paths currently unsupported",
)));
return Poll::Ready(Err(io::Error::new(
io::ErrorKind::InvalidInput,
"UnixDatagram::poll_send_to(): abstract paths currently unsupported",
)));

Copy link
Copy Markdown
Owner Author

@martin-augment martin-augment Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Gemini AI reviewer is correct! Since some UDP related methods do not support abstract paths it would be better to return an InvalidInput kind of error to better tell the caller what is the issue.

}

self.io
.registration()
.poll_write_io(cx, || self.io.send_to(buf, target.as_ref()))
Expand Down
22 changes: 2 additions & 20 deletions tokio/src/net/unix/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ use crate::util::check_socket_for_blocking;

use std::fmt;
use std::io;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::unix::ffi::OsStrExt;
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
use std::os::unix::net::{self, SocketAddr as StdSocketAddr};
use std::os::unix::net;
use std::path::Path;
use std::task::{ready, Context, Poll};

Expand Down Expand Up @@ -77,19 +71,7 @@ impl UnixListener {
where
P: AsRef<Path>,
{
// For now, we handle abstract socket paths on linux here.
#[cfg(any(target_os = "linux", target_os = "android"))]
let addr = {
let os_str_bytes = path.as_ref().as_os_str().as_bytes();
if os_str_bytes.starts_with(b"\0") {
StdSocketAddr::from_abstract_name(&os_str_bytes[1..])?
} else {
StdSocketAddr::from_pathname(path)?
}
};
#[cfg(not(any(target_os = "linux", target_os = "android")))]
let addr = StdSocketAddr::from_pathname(path)?;

let addr = SocketAddr::from_path(path)?.0;
let listener = mio::net::UnixListener::bind_addr(&addr)?;
let io = PollEvented::new(listener)?;
Ok(UnixListener { io })
Expand Down
34 changes: 33 additions & 1 deletion tokio/src/net/unix/socketaddr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
use std::fmt;
use std::io;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::unix::ffi::OsStrExt;
use std::os::unix::net::SocketAddr as StdSocketAddr;
use std::path::Path;

/// An address associated with a Tokio Unix socket.
Expand All @@ -7,9 +15,33 @@ use std::path::Path;
/// can convert to and from the standard library `SocketAddr` type using the
/// [`From`] trait.
#[derive(Clone)]
pub struct SocketAddr(pub(super) std::os::unix::net::SocketAddr);
pub struct SocketAddr(pub(super) StdSocketAddr);

impl SocketAddr {
/// Creates an address from a path
///
/// On Linux, allows the path to start with a leading `\0` to declare
/// a socket path within the abstract namespace.
pub fn from_path<P>(path: P) -> io::Result<Self>
where
P: AsRef<Path>,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc for SocketAddr::from_path says “On Linux …”, but the implementation is enabled for target_os = "android" as well (cfg(any(linux, android))), which makes the docs/intent slightly misleading.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Augment AI reviewer is correct! The method is available for both Linux and Android (Android is based on Linux but still there are differences), so the documentation should be more explicit that Android is also supported.

{
// For now, we handle abstract socket paths on linux here.
#[cfg(any(target_os = "linux", target_os = "android"))]
let addr = {
let os_str_bytes = path.as_ref().as_os_str().as_bytes();
if os_str_bytes.starts_with(b"\0") {
StdSocketAddr::from_abstract_name(&os_str_bytes[1..])?
} else {
StdSocketAddr::from_pathname(path)?
}
};
#[cfg(not(any(target_os = "linux", target_os = "android")))]
let addr = StdSocketAddr::from_pathname(path)?;

Ok(SocketAddr(addr))
}

/// Returns `true` if the address is unnamed.
///
/// Documentation reflected in [`SocketAddr`].
Expand Down
22 changes: 2 additions & 20 deletions tokio/src/net/unix/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ use std::fmt;
use std::future::poll_fn;
use std::io::{self, Read, Write};
use std::net::Shutdown;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::unix::ffi::OsStrExt;
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
use std::os::unix::net::{self, SocketAddr as StdSocketAddr};
use std::os::unix::net;
use std::path::Path;
use std::pin::Pin;
use std::task::{Context, Poll};
Expand Down Expand Up @@ -73,19 +67,7 @@ impl UnixStream {
where
P: AsRef<Path>,
{
// On linux, abstract socket paths need to be considered.
#[cfg(any(target_os = "linux", target_os = "android"))]
let addr = {
let os_str_bytes = path.as_ref().as_os_str().as_bytes();
if os_str_bytes.starts_with(b"\0") {
StdSocketAddr::from_abstract_name(&os_str_bytes[1..])?
} else {
StdSocketAddr::from_pathname(path)?
}
};
#[cfg(not(any(target_os = "linux", target_os = "android")))]
let addr = StdSocketAddr::from_pathname(path)?;

let addr = SocketAddr::from_path(path)?.0;
let stream = mio::net::UnixStream::connect_addr(&addr)?;
let stream = UnixStream::new(stream)?;

Expand Down
48 changes: 48 additions & 0 deletions tokio/tests/uds_datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ use tokio::try_join;

use std::future::poll_fn;
use std::io;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::linux::net::SocketAddrExt;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong platform import for Android in test file

Medium Severity

The import std::os::linux::net::SocketAddrExt is gated behind cfg(any(target_os = "linux", target_os = "android")), but std::os::linux only exists on Linux — not Android. This will fail to compile when targeting Android. The correct pattern (used in socketaddr.rs and uds_stream.rs) uses separate cfg attributes: #[cfg(target_os = "android")] use std::os::android::net::SocketAddrExt and #[cfg(target_os = "linux")] use std::os::linux::net::SocketAddrExt.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Bugbot AI reviewer is correct! The IT test should use one import for Linux and a different one for Android. Since the IT tests are executed only on Linux in the Github Actions CI environment there is no issue at the moment because it is always Linux and the imported file matches the OS. A problem would occur when someone tries to run the test on Android.

#[cfg(any(target_os = "linux", target_os = "android"))]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#[cfg(any(target_os = "linux", target_os = "android"))] combined with std::os::linux::net::SocketAddrExt is not portable: on Android the extension trait is under std::os::android::net, so this import will fail to compile for target_os = "android".

Severity: high

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The Augment AI reviewer is correct! The IT test should use one import for Linux and a different one for Android. Since the IT tests are executed only on Linux in the Github Actions CI environment there is no issue at the moment because it is always Linux and the imported file matches the OS. A problem would occur when someone tries to run the test on Android.

use std::os::unix::net as std_net;
Comment on lines +11 to +14
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

On Rust Android targets, is the abstract Unix socket extension trait available as std::os::android::net::SocketAddrExtrather thanstd::os::linux::net::SocketAddrExt?

💡 Result:

Yes. On Android targets the abstract Unix-socket extension trait is exposed as std::os::android::net::SocketAddrExt (and on Linux as std::os::linux::net::SocketAddrExt), as shown by the std source and the rendered docs’ platform-specific import example. [1], [2]

Practical pattern:

#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;

[1] (doc.rust-lang.org) [2] (doc.rust-lang.org)

Citations:


Split the import by platform for Android compatibility.

Lines 11-14 compile for both Linux and Android, but SocketAddrExt is platform-specific. The code attempts to import from std::os::linux::net::SocketAddrExt for both targets, which fails on Android. Android requires std::os::android::net::SocketAddrExt instead. Mirror the split import pattern in tokio/src/net/unix/socketaddr.rs.

🔧 Proposed fix
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use std::os::linux::net::SocketAddrExt;
+#[cfg(target_os = "android")]
+use std::os::android::net::SocketAddrExt;
+#[cfg(target_os = "linux")]
+use std::os::linux::net::SocketAddrExt;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::linux::net::SocketAddrExt;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::unix::net as std_net;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::unix::net as std_net;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tokio/tests/uds_datagram.rs` around lines 11 - 14, The imports currently use
std::os::linux::net::SocketAddrExt for both Linux and Android which breaks on
Android; split the cfg imports so that #[cfg(target_os = "linux")] imports
SocketAddrExt from std::os::linux::net and #[cfg(target_os = "android")] imports
SocketAddrExt from std::os::android::net, while keeping the existing cfg wrapper
for std::os::unix::net as std_net; update the cfg attributes around the
SocketAddrExt and std_net uses (symbols: SocketAddrExt, std_net) so each target
pulls the correct platform module.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value:good-to-have; category:bug; feedback: The CodeRabbit AI reviewer is correct! The IT test should use one import for Linux and a different one for Android. Since the IT tests are executed only on Linux in the Github Actions CI environment there is no issue at the moment because it is always Linux and the imported file matches the OS. A problem would occur when someone tries to run the test on Android.

use std::sync::Arc;

async fn echo_server(socket: UnixDatagram) -> io::Result<()> {
Expand Down Expand Up @@ -71,6 +75,50 @@ async fn echo_from() -> io::Result<()> {
Ok(())
}

#[allow(clippy::bool_assert_comparison)]
#[tokio::test]
#[cfg_attr(miri, ignore)] // No `socket` on miri.
async fn recv_abstract() -> io::Result<()> {
// Generate 128-bit random string prefixed by `\0` as socket path
let abstract_path = format!(
"\0{:016x}{:016x}",
rand::random::<u64>(),
rand::random::<u64>()
);

// On non-Linux platforms, abstract socket paths are rejected
#[cfg(not(any(target_os = "linux", target_os = "android")))]
assert_eq!(
UnixDatagram::bind(&abstract_path).err().map(|e| e.kind()),
Some(io::ErrorKind::InvalidInput)
);

// Remaining test is Linux-only
#[cfg(any(target_os = "linux", target_os = "android"))]
{
// Create socket in abstract namespace
let recv_socket = UnixDatagram::bind(&abstract_path)?;

// Send message from stdlib
//
//FIXME: Use `tokio` native here once passing abstract socket paths to
// `send_to`/`connect` is implemented
let send_socket = std_net::UnixDatagram::unbound()?;
send_socket.send_to_addr(
b"READY=1\n",
&std_net::SocketAddr::from_abstract_name(&abstract_path[1..])?,
)?;

// Receive and validate message
let mut buf = vec![0u8; 32];
let (len, addr) = recv_socket.recv_from(&mut buf).await?;
assert_eq!(&buf[0..len], b"READY=1\n");
assert_eq!(addr.is_unnamed(), true);
}

Ok(())
}

// Even though we use sync non-blocking io we still need a reactor.
#[tokio::test]
#[cfg_attr(miri, ignore)] // No SOCK_DGRAM for `socketpair` in miri.
Expand Down