5 releases

new 0.9.4 Apr 8, 2024
0.9.3 Jul 2, 2022
0.9.2 Jun 28, 2022
0.9.1 Jun 26, 2022
0.9.0 Jun 26, 2022

#528 in Asynchronous

Download history 19/week @ 2024-01-07 10/week @ 2024-01-14 26/week @ 2024-01-21 31/week @ 2024-01-28 28/week @ 2024-02-25 2/week @ 2024-03-03 10/week @ 2024-03-10 59/week @ 2024-03-31

70 downloads per month

MIT license

8KB
52 lines

tokio-send-fd

⚠️This crate is deprecated. Use async-send-fd instead.

A library to send tokio UnixStream and raw file descriptors over tokio UnixStream connections.

Crates.io MIT licensed Build Status

Overview

The crate is a library for sending and receiving Unix file descriptors over tokio UnixStream connections. You can transfer RawFd or UnixStream. See test_raw_fd.rs and test_tokio_stream.rs for examples.

Creating tokio::net::UnixStream from RawFd

If you want to create tokio UnixStream from a raw file descriptor created by os' UnixStream::pair call, you should make it set_nonblocking(true), otherwise tokio stream will block event in async functions ⚠️

Transfering socket pair ownership

Sending a socket of a socket pair doesn't close the local copy, which leads to having the socket being opened until the sender is shut down. If you want counterparties to detect peer shutdown, you have to close socket pair right after sending a socket to a peer. Use close Posix call.

Dependencies

~3–13MB
~123K SLoC