id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/tests/io.rs:3
impl AsyncRead for Rd { fn poll_read( mut self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<io::Result<usize>> { if self.0 { buf[0..11].copy_from_slice(b"hello world"); self.0 = false; Po...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io.rs
MIT
29e417c257c62ae95cfa73f6b56825b3f833dde8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/io.rs
81
134
tokio-rs/tokio:tokio/tests/io.rs:4
task.enter(|cx| { let mut rd = Rd(true); let mut wr = Wr(buf); let copy = tokio::io::copy(&mut rd, &mut wr); pin_mut!(copy); let n = assert_ready_ok!(copy.poll(cx)); assert_eq!(n, 11); assert_eq!(wr.0[..], b"hello world"[..]); }); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io.rs
MIT
29e417c257c62ae95cfa73f6b56825b3f833dde8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/io.rs
121
134
tokio-rs/tokio:tokio/tests/io_async_fd.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(unix, feature = "full"))] use std::os::unix::io::{AsRawFd, RawFd}; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use std::time::Duration; use std::{ future::Future, io::{self, ErrorKind, Read, Write}, os::fd::OwnedFd, task::{Context, Waker}, }; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_fd.rs:2
impl TestWaker { fn new() -> Self { let inner: Arc<TestWakerInner> = Default::default(); Self { inner: inner.clone(), waker: futures::task::waker(inner), } } fn awoken(&self) -> bool { self.inner.awoken.swap(false, Ordering::SeqCst) } fn con...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_fd.rs:3
} impl Write for &FileDescriptor { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { write(&self.fd, buf).map_err(io::Error::from) } fn flush(&mut self) -> io::Result<()> { Ok(()) } } impl Write for FileDescriptor { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
81
140
tokio-rs/tokio:tokio/tests/io_async_fd.rs:4
fn socketpair() -> (FileDescriptor, FileDescriptor) { use nix::sys::socket::{self, AddressFamily, SockFlag, SockType}; let (fd_a, fd_b) = socket::socketpair( AddressFamily::Unix, SockType::Stream, None, SockFlag::empty(), ) .expect("socketpair"); let fds = (FileDescr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
121
180
tokio-rs/tokio:tokio/tests/io_async_fd.rs:5
tokio::select! { biased; _ = tokio::time::sleep(Duration::from_millis(10)) => {}, _ = afd_a.readable() => panic!("Unexpected readable state"), _ = afd_b.readable() => panic!("Unexpected readable state"), } } #[tokio::test] async fn reset_readable() { let (a, mut b) = socketpair(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
161
220
tokio-rs/tokio:tokio/tests/io_async_fd.rs:6
tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } b.write_all(b"0").unwrap(); // We can observe the new readable event afd_a.readable().await.unwrap().clear_ready(); } #[tokio::test] async fn reset_writable() { let (a, b)...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
201
260
tokio-rs/tokio:tokio/tests/io_async_fd.rs:7
#[derive(Debug)] struct ArcFd<T>(Arc<T>); impl<T: AsRawFd> AsRawFd for ArcFd<T> { fn as_raw_fd(&self) -> RawFd { self.0.as_raw_fd() } } #[tokio::test] async fn drop_closes() { let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); assert_eq!( ErrorKind::WouldBlock, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
241
300
tokio-rs/tokio:tokio/tests/io_async_fd.rs:8
assert_eq!( ErrorKind::WouldBlock, b.read(&mut [0]).err().unwrap().kind() ); std::mem::drop(arc_fd); // suppress unnecessary clone clippy warning } #[tokio::test] async fn reregister() { let (a, _b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); let a = afd_a.into_inner(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
281
340
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } // Write something down b again and make sure we're reawoken b.write_all(b"0").unwrap(); let _ = readable.await....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:10
let _ = afd_a.try_io(Interest::READABLE, |_| { called = true; Ok(()) }); assert!( called, "closure should have been called, since socket should have data available to read" ); } { let mut called = false; let _ = afd_a.try_i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
361
420
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
{ let mut called = false; let _ = afd_a.try_io(Interest::WRITABLE, |_| { called = true; Ok(()) }); assert!( called, "closure should have been called, since socket should still be marked as writable" ); } { let mut ca...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
let mut tasks = Vec::new(); for _ in 0..10 { let afd_a = afd_a.clone(); let barrier = barrier.clone(); let f = async move { let notify_barrier = async { barrier.wait().await; futures::future::pending::<()>().await; }; toki...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
#[tokio::test] async fn poll_fns() { let (a, b) = socketpair(); let afd_a = Arc::new(AsyncFd::new(a).unwrap()); let afd_b = Arc::new(AsyncFd::new(b).unwrap()); // Fill up the write side of A let mut bytes = 0; while let Ok(amt) = afd_a.get_ref().write(&[0; 512]) { bytes += amt; } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
barrier_clone.wait().await; let _ = std::future::poll_fn(|cx| afd_a_2.as_ref().poll_write_ready(cx)).await; }); r_barrier.wait().await; w_barrier.wait().await; let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = &mut readable => unreachable!(), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
assert_pending!(pinned .as_mut() .poll(&mut Context::from_waker(futures::task::noop_waker_ref()))); pinned } fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() } #[test] fn driver_shutdown_wakes_currently...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
561
620
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; std::mem::drop(rt); assert_err!(futures::executor::block_on(afd_a.readable())); } #[test] fn driver_shutdown_wakes_pending_race() { // TODO: make this a loom test for _ in 0..100 { let rt = rt(); l...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
601
660
tokio-rs/tokio:tokio/tests/io_async_fd.rs:17
#[test] fn driver_shutdown_wakes_currently_pending_polls() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let readable = assert_pending(poll_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
641
700
tokio-rs/tokio:tokio/tests/io_async_fd.rs:18
let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let mut write_ready = rt.block_on(afd_a.writable()).unwrap(); std::mem::drop(rt); write_ready.clear_ready(); } #[test] fn driver_shutdown_wakes_poll_race() { // ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
681
740
tokio-rs/tokio:tokio/tests/io_async_fd.rs:19
async fn priority_event_on_oob_data() { use std::net::SocketAddr; use tokio::io::Interest; let addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); let listener = std::net::TcpListener::bind(addr).unwrap(); let addr = listener.local_addr().unwrap(); let client = std::net::TcpStream::connect(ad...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
721
780
tokio-rs/tokio:tokio/tests/io_async_fd.rs:20
use tokio::io::{Interest, Ready}; let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); b.write_all(b"0").unwrap(); let mut guard = afd_a .ready(Interest::READABLE | Interest::WRITABLE) .await .unwrap(); assert_eq!(guard.ready(), Ready::READABLE | Ready::WR...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
761
820
tokio-rs/tokio:tokio/tests/io_async_fd.rs:21
guard.clear_ready_matching(Ready::WRITABLE); assert_eq!(guard.ready(), Ready::EMPTY); } #[tokio::test] #[cfg_attr(miri, ignore)] // No socket in miri. #[cfg(target_os = "linux")] async fn await_error_readiness_timestamping() { use std::net::{Ipv4Addr, SocketAddr}; use tokio::io::{Interest, Ready}; le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
801
860
tokio-rs/tokio:tokio/tests/io_async_fd.rs:22
fn configure_timestamping_socket(udp_socket: &std::net::UdpSocket) -> std::io::Result<libc::c_int> { // enable software timestamping, and specifically software send timestamping let options = libc::SOF_TIMESTAMPING_SOFTWARE | libc::SOF_TIMESTAMPING_TX_SOFTWARE; let res = unsafe { libc::setsockopt( ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
841
900
tokio-rs/tokio:tokio/tests/io_async_fd.rs:23
&recv_err as *const _ as *const libc::c_void, std::mem::size_of_val(&recv_err) as libc::socklen_t, ); if res == -1 { panic!("{:?}", std::io::Error::last_os_error()); } } // Spawn a separate thread for sending messages tokio::spawn(async move { // Set ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
881
940
tokio-rs/tokio:tokio/tests/io_async_fd.rs:24
if unsafe { libc::sendmsg(socket_fd, &msg, 0) } == -1 { panic!("{:?}", std::io::Error::last_os_error()) } }); let fd = AsyncFd::new(socket).unwrap(); let guard = fd.ready(Interest::ERROR).await.unwrap(); assert_eq!(guard.ready(), Ready::ERROR); } #[derive(Debug, PartialEq, Eq)] st...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd.rs
921
959
tokio-rs/tokio:tokio/tests/io_async_fd.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(unix, feature = "full"))] use std::os::unix::io::{AsRawFd, RawFd}; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use std::time::Duration; use std::{ future::Future, io::{self, ErrorKind, Read, Write}, task::{Context, Waker}, }; use nix::unistd::{rea...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_fd.rs:2
fn new() -> Self { let inner: Arc<TestWakerInner> = Default::default(); Self { inner: inner.clone(), waker: futures::task::waker(inner), } } fn awoken(&self) -> bool { self.inner.awoken.swap(false, Ordering::SeqCst) } fn context(&self) -> Contex...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_fd.rs:3
impl Write for &FileDescriptor { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { write(&self.fd, buf).map_err(io::Error::from) } fn flush(&mut self) -> io::Result<()> { Ok(()) } } impl Write for FileDescriptor { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
81
140
tokio-rs/tokio:tokio/tests/io_async_fd.rs:4
use nix::sys::socket::{self, AddressFamily, SockFlag, SockType}; let (fd_a, fd_b) = socket::socketpair( AddressFamily::Unix, SockType::Stream, None, SockFlag::empty(), ) .expect("socketpair"); let fds = (FileDescriptor { fd: fd_a }, FileDescriptor { fd: fd_b }); set...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
121
180
tokio-rs/tokio:tokio/tests/io_async_fd.rs:5
biased; _ = tokio::time::sleep(Duration::from_millis(10)) => {}, _ = afd_a.readable() => panic!("Unexpected readable state"), _ = afd_b.readable() => panic!("Unexpected readable state"), } } #[tokio::test] async fn reset_readable() { let (a, mut b) = socketpair(); let afd_a = Async...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
161
220
tokio-rs/tokio:tokio/tests/io_async_fd.rs:6
tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } b.write_all(b"0").unwrap(); // We can observe the new readable event afd_a.readable().await.unwrap().clear_ready(); } #[tokio::test] async fn reset_writable() { let (a, b)...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
201
260
tokio-rs/tokio:tokio/tests/io_async_fd.rs:7
#[derive(Debug)] struct ArcFd<T>(Arc<T>); impl<T: AsRawFd> AsRawFd for ArcFd<T> { fn as_raw_fd(&self) -> RawFd { self.0.as_raw_fd() } } #[tokio::test] async fn drop_closes() { let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); assert_eq!( ErrorKind::WouldBlock, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
241
300
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
tokio::pin!(readable); tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } // Write something down b again and make sure we're reawoken b.write_all(b"0").unwrap(); let _ = readable.await.unwrap(); } #[tokio::test] async fn ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:10
called = true; Ok(()) }); assert!( called, "closure should have been called, since socket should have data available to read" ); } { let mut called = false; let _ = afd_a.try_io(Interest::READABLE, |_| { called = true; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
361
420
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
let mut called = false; let _ = afd_a.try_io(Interest::WRITABLE, |_| { called = true; Ok(()) }); assert!( called, "closure should have been called, since socket should still be marked as writable" ); } { let mut called = fal...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
for _ in 0..10 { let afd_a = afd_a.clone(); let barrier = barrier.clone(); let f = async move { let notify_barrier = async { barrier.wait().await; futures::future::pending::<()>().await; }; tokio::select! { bia...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
let _ = std::future::poll_fn(|cx| afd_a_2.as_ref().poll_write_ready(cx)).await; }); r_barrier.wait().await; w_barrier.wait().await; let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = &mut readable => unreachable!(), _ = tokio::task::yield_now() => {} ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
.as_mut() .poll(&mut Context::from_waker(futures::task::noop_waker_ref()))); pinned } fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() } #[test] fn driver_shutdown_wakes_currently_pending() { let rt = rt();...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
561
620
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; std::mem::drop(rt); assert_err!(futures::executor::block_on(afd_a.readable())); } #[test] fn driver_shutdown_wakes_pending_race() { // TODO: make this a loom test for _ in 0..100 { let rt = rt(); let (a, _b) = socketpai...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
601
660
tokio-rs/tokio:tokio/tests/io_async_fd.rs:17
fn driver_shutdown_wakes_currently_pending_polls() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let readable = assert_pending(poll_readable...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
641
700
tokio-rs/tokio:tokio/tests/io_async_fd.rs:18
let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let mut write_ready = rt.block_on(afd_a.writable()).unwrap(); std::mem::drop(rt); write_ready.clear_ready(); } #[test] fn driver_shutdown_wakes_poll_race() { // TODO: make this a lo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
681
740
tokio-rs/tokio:tokio/tests/io_async_fd.rs:19
use std::net::SocketAddr; use tokio::io::Interest; let addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); let listener = std::net::TcpListener::bind(addr).unwrap(); let addr = listener.local_addr().unwrap(); let client = std::net::TcpStream::connect(addr).unwrap(); let client = AsyncFd::with...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
721
780
tokio-rs/tokio:tokio/tests/io_async_fd.rs:20
let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); b.write_all(b"0").unwrap(); let mut guard = afd_a .ready(Interest::READABLE | Interest::WRITABLE) .await .unwrap(); assert_eq!(guard.ready(), Ready::READABLE | Ready::WRITABLE); guard.clear_ready_matchin...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
761
820
tokio-rs/tokio:tokio/tests/io_async_fd.rs:21
assert_eq!(guard.ready(), Ready::EMPTY); } #[tokio::test] #[cfg_attr(miri, ignore)] // No socket in miri. #[cfg(target_os = "linux")] async fn await_error_readiness_timestamping() { use std::net::{Ipv4Addr, SocketAddr}; use tokio::io::{Interest, Ready}; let address_a = SocketAddr::from((Ipv4Addr::LOCALHO...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
801
860
tokio-rs/tokio:tokio/tests/io_async_fd.rs:22
// enable software timestamping, and specifically software send timestamping let options = libc::SOF_TIMESTAMPING_SOFTWARE | libc::SOF_TIMESTAMPING_TX_SOFTWARE; let res = unsafe { libc::setsockopt( udp_socket.as_raw_fd(), libc::SOL_SOCKET, libc::SO_TIMESTAMP, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
841
900
tokio-rs/tokio:tokio/tests/io_async_fd.rs:23
std::mem::size_of_val(&recv_err) as libc::socklen_t, ); if res == -1 { panic!("{:?}", std::io::Error::last_os_error()); } } // Spawn a separate thread for sending messages tokio::spawn(async move { // Set the destination address. This address is invalid in this c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
881
940
tokio-rs/tokio:tokio/tests/io_async_fd.rs:24
panic!("{:?}", std::io::Error::last_os_error()) } }); let fd = AsyncFd::new(socket).unwrap(); let guard = fd.ready(Interest::ERROR).await.unwrap(); assert_eq!(guard.ready(), Ready::ERROR); } #[derive(Debug, PartialEq, Eq)] struct InvalidSource; impl AsRawFd for InvalidSource { fn as_raw_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c03a37fa0b88ec20df22bec2b035852fd1eab44e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/io_async_fd.rs
921
958
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
for _ in 0..10 { let afd_a = afd_a.clone(); let barrier = barrier.clone(); let f = async move { let notify_barrier = async { barrier.wait().await; futures::future::pending::<()>().await; }; tokio::select! { bia...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
#[tokio::test] // Block on https://github.com/rust-lang/miri/issues/4374 #[cfg_attr(miri, ignore)] async fn poll_fns() { let (a, b) = socketpair(); let afd_a = Arc::new(AsyncFd::new(a).unwrap()); let afd_b = Arc::new(AsyncFd::new(b).unwrap()); // Fill up the write side of A let mut bytes = 0; w...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
.poll_write_ready(cx)))); barrier_clone.wait().await; let _ = std::future::poll_fn(|cx| afd_a_2.as_ref().poll_write_ready(cx)).await; }); r_barrier.wait().await; w_barrier.wait().await; let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = &mut ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
assert_pending!(pinned .as_mut() .poll(&mut Context::from_waker(futures::task::noop_waker_ref()))); pinned } fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() } #[test] fn driver_shutdown_wakes_currently...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
561
620
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; std::mem::drop(rt); assert_err!(futures::executor::block_on(afd_a.readable())); } #[test] fn driver_shutdown_wakes_pending_race() { // TODO: make this a loom test for _ in 0..100 { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
601
660
tokio-rs/tokio:tokio/tests/io_async_fd.rs:17
#[test] fn driver_shutdown_wakes_currently_pending_polls() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let readable = assert_pending(poll_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
641
700
tokio-rs/tokio:tokio/tests/io_async_fd.rs:18
fn driver_shutdown_then_clear_readiness() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let mut write_ready = rt.block_on(afd_a.writable()).unwrap(); std::mem::drop(rt); write_ready.clear_ready(); } #[test...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
681
740
tokio-rs/tokio:tokio/tests/io_async_fd.rs:19
#[cfg(any(target_os = "linux", target_os = "android"))] async fn priority_event_on_oob_data() { use std::net::SocketAddr; use tokio::io::Interest; let addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); let listener = std::net::TcpListener::bind(addr).unwrap(); let addr = listener.local_addr().unw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
721
780
tokio-rs/tokio:tokio/tests/io_async_fd.rs:20
async fn clear_ready_matching_clears_ready() { use tokio::io::{Interest, Ready}; let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); b.write_all(b"0").unwrap(); let mut guard = afd_a .ready(Interest::READABLE | Interest::WRITABLE) .await .unwrap(); as...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
761
820
tokio-rs/tokio:tokio/tests/io_async_fd.rs:21
guard.clear_ready_matching(Ready::WRITABLE); assert_eq!(guard.ready(), Ready::EMPTY); } #[tokio::test] #[cfg_attr(miri, ignore)] // No socket in miri. #[cfg(target_os = "linux")] async fn await_error_readiness_timestamping() { use std::net::{Ipv4Addr, SocketAddr}; use tokio::io::{Interest, Ready}; le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
801
860
tokio-rs/tokio:tokio/tests/io_async_fd.rs:22
#[cfg(target_os = "linux")] fn configure_timestamping_socket(udp_socket: &std::net::UdpSocket) -> std::io::Result<libc::c_int> { // enable software timestamping, and specifically software send timestamping let options = libc::SOF_TIMESTAMPING_SOFTWARE | libc::SOF_TIMESTAMPING_TX_SOFTWARE; let res = unsafe ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
841
900
tokio-rs/tokio:tokio/tests/io_async_fd.rs:23
libc::IP_RECVERR, &recv_err as *const _ as *const libc::c_void, std::mem::size_of_val(&recv_err) as libc::socklen_t, ); if res == -1 { panic!("{:?}", std::io::Error::last_os_error()); } } // Spawn a separate thread for sending messages tokio::spaw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2440d113ff9841060b1876628c1153f0bcf2945c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2440d113ff9841060b1876628c1153f0bcf2945c/tokio/tests/io_async_fd.rs
881
940
tokio-rs/tokio:tokio/tests/io_async_fd.rs:4
use nix::sys::socket::{self, AddressFamily, SockFlag, SockType}; let (fd_a, fd_b) = socket::socketpair( AddressFamily::Unix, SockType::Stream, None, SockFlag::empty(), ) .expect("socketpair"); let fds = (FileDescriptor { fd: fd_a }, FileDescriptor { fd: fd_b }); set...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
121
180
tokio-rs/tokio:tokio/tests/io_async_fd.rs:5
tokio::select! { biased; _ = tokio::time::sleep(Duration::from_millis(10)) => {}, _ = afd_a.readable() => panic!("Unexpected readable state"), _ = afd_b.readable() => panic!("Unexpected readable state"), } } #[tokio::test] #[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
161
220
tokio-rs/tokio:tokio/tests/io_async_fd.rs:6
tokio::pin!(readable); tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } b.write_all(b"0").unwrap(); // We can observe the new readable event afd_a.readable().await.unwrap().clear_ready(); } #[tokio::test] #[cfg_attr(mir...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
201
260
tokio-rs/tokio:tokio/tests/io_async_fd.rs:7
let _ = writable.await.unwrap(); } #[derive(Debug)] struct ArcFd<T>(Arc<T>); impl<T: AsRawFd> AsRawFd for ArcFd<T> { fn as_raw_fd(&self) -> RawFd { self.0.as_raw_fd() } } #[tokio::test] #[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. async fn drop_closes() { let (a, mut b) = socketpair(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
241
300
tokio-rs/tokio:tokio/tests/io_async_fd.rs:8
let arc_fd = Arc::new(a); let afd_a = AsyncFd::new(ArcFd(arc_fd.clone())).unwrap(); std::mem::drop(afd_a); assert_eq!( ErrorKind::WouldBlock, b.read(&mut [0]).err().unwrap().kind() ); std::mem::drop(arc_fd); // suppress unnecessary clone clippy warning } #[tokio::test] #[cfg_attr(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
281
340
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
// Should clear the readable state let _ = guard.try_io(|_| io::Result::<()>::Err(ErrorKind::WouldBlock.into())); // Assert not readable let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:10
// Give the runtime some time to update bookkeeping. b.write_all(&[0]).unwrap(); tokio::task::yield_now().await; { let mut called = false; let _ = afd_a.try_io(Interest::READABLE, |_| { called = true; Ok(()) }); assert!( called, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
361
420
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
async fn try_io_writable() { let (a, _b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); // Give the runtime some time to update bookkeeping. tokio::task::yield_now().await; { let mut called = false; let _ = afd_a.try_io(Interest::WRITABLE, |_| { called = true; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
#[tokio::test] #[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. async fn multiple_waiters() { let (a, mut b) = socketpair(); let afd_a = Arc::new(AsyncFd::new(a).unwrap()); let barrier = Arc::new(tokio::sync::Barrier::new(11)); let mut tasks = Vec::new(); for _ in 0..10 { let afd...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
}, _ = barrier.wait() => {} } b.write_all(b"0").unwrap(); all_tasks.await.unwrap(); } #[tokio::test] #[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. async fn poll_fns() { let (a, b) = socketpair(); let afd_a = Arc::new(AsyncFd::new(a).unwrap()); let afd_b = Arc::new(AsyncFd...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
let afd_a_2 = afd_a.clone(); let w_barrier = Arc::new(tokio::sync::Barrier::new(2)); let barrier_clone = w_barrier.clone(); let mut write_fut = tokio::spawn(async move { // Move waker onto this task first assert_pending!(poll!(std::future::poll_fn(|cx| afd_a_2 .as_ref() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
drain(afd_b.get_ref(), bytes); // now we should be writable (ie - the waker for poll_write should still be registered after we wake the read side) let _ = write_fut.await; } fn assert_pending<T: std::fmt::Debug, F: Future<Output = T>>(f: F) -> std::pin::Pin<Box<F>> { let mut pinned = Box::pin(f); ass...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
561
620
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
// The future is initialized **after** dropping the rt. assert_err!(futures::executor::block_on(afd_a.readable())); } #[test] #[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. fn driver_shutdown_wakes_future_pending() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _ent...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
601
660
tokio-rs/tokio:tokio/tests/io_async_fd.rs:17
assert_err!(futures::executor::block_on(afd_a.readable())); } } async fn poll_readable<T: AsRawFd>(fd: &AsyncFd<T>) -> std::io::Result<AsyncFdReadyGuard<'_, T>> { std::future::poll_fn(|cx| fd.poll_read_ready(cx)).await } async fn poll_writable<T: AsRawFd>(fd: &AsyncFd<T>) -> std::io::Result<AsyncFdReadyGuard<...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
641
700
tokio-rs/tokio:tokio/tests/io_async_fd.rs:18
let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; std::mem::drop(rt); assert_err!(futures::executor::block_on(poll_readable(&afd_a))); assert_err!(futures::executor::block_on(poll_writable(&afd_a))); } #[test] #[cfg_attr(miri, ignore)] ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
681
740
tokio-rs/tokio:tokio/tests/io_async_fd.rs:19
AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let _ = std::thread::spawn(move || std::mem::drop(rt)); // The poll variants will always return an error in this case assert_err!(futures::executor::block_on(poll_readable(&afd_a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
721
780
tokio-rs/tokio:tokio/tests/io_async_fd.rs:20
let res = libc::send( stream.as_raw_fd(), data.as_ptr().cast(), data.len(), libc::MSG_OOB, ); if res == -1 { Err(io::Error::last_os_error()) } else { Ok(res as usize) } } } #[tokio::test] #[cfg_attr(miri, ignore...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
761
820
tokio-rs/tokio:tokio/tests/io_async_fd.rs:21
async fn clear_ready_matching_clears_ready_mut() { use tokio::io::{Interest, Ready}; let (a, mut b) = socketpair(); let mut afd_a = AsyncFd::new(a).unwrap(); b.write_all(b"0").unwrap(); let mut guard = afd_a .ready_mut(Interest::READABLE | Interest::WRITABLE) .await .unwra...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
801
860
tokio-rs/tokio:tokio/tests/io_async_fd.rs:22
socket.connect(address_b).unwrap(); let fd = AsyncFd::new(socket).unwrap(); tokio::select! { _ = fd.ready(Interest::ERROR) => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } let buf = b"hello there"; fd.get_ref().send(buf).unwrap(); // the send timestamp s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
841
900
tokio-rs/tokio:tokio/tests/io_async_fd.rs:23
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. #[cfg(target_os = "linux")] async fn await_error_readiness_invalid_address() { use std::net::{Ipv4Addr, SocketAddr}; use tokio::io::{Interest, Ready}; let socket_addr = SocketAddr::from((Ipv4Addr::LOCALHOST, 0)); let socket = std::net::UdpSocke...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
881
940
tokio-rs/tokio:tokio/tests/io_async_fd.rs:24
let message = "Hello, Socket!"; // Prepare the message structure for sendmsg let mut iov = libc::iovec { iov_base: message.as_ptr() as *mut libc::c_void, iov_len: message.len(), }; // Prepare the destination address for the sendmsg call let dest_sockaddr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
921
977
tokio-rs/tokio:tokio/tests/io_async_fd.rs:25
let original = Arc::new(InvalidSource); let error = AsyncFd::try_new(original.clone()).unwrap_err(); let (returned, _cause) = error.into_parts(); assert!(Arc::ptr_eq(&original, &returned)); } #[tokio::test] async fn try_with_interest() { let original = Arc::new(InvalidSource); let error = AsyncF...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbdceb91ac8d863d6f02be0a1ed34f13abaa91c0/tokio/tests/io_async_fd.rs
961
977
tokio-rs/tokio:tokio/tests/io_async_fd.rs:8
let arc_fd = Arc::new(a); let afd_a = AsyncFd::new(ArcFd(arc_fd.clone())).unwrap(); std::mem::drop(afd_a); assert_eq!( ErrorKind::WouldBlock, b.read(&mut [0]).err().unwrap().kind() ); std::mem::drop(arc_fd); // suppress unnecessary clone clippy warning } #[tokio::test] #[cfg_attr(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
281
340
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
// Should clear the readable state let _ = guard.try_io(|_| io::Result::<()>::Err(ErrorKind::WouldBlock.into())); // Assert not readable let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:10
tokio::task::yield_now().await; guard.unwrap().clear_ready() }, _ = notify_barrier => unreachable!(), } std::mem::drop(afd_a); }; tasks.push(tokio::spawn(f)); } let mut all_tasks = futures::future::try_join_all(tasks)...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
361
420
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
let waker = TestWaker::new(); assert_pending!(afd_a.as_ref().poll_read_ready(&mut waker.context())); let afd_a_2 = afd_a.clone(); let r_barrier = Arc::new(tokio::sync::Barrier::new(2)); let barrier_clone = r_barrier.clone(); let read_fut = tokio::spawn(async move { // Move waker onto this...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
_ = tokio::task::yield_now() => {} } // Make A readable. We expect that 'readable' and 'read_fut' will both complete quickly afd_b.get_ref().write_all(b"0").unwrap(); let _ = tokio::join!(readable, read_fut); // Our original waker should _not_ be awoken (poll_read_ready retains only the last cont...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
#[test] #[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. fn driver_shutdown_wakes_currently_pending() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let readable = assert_pending(afd_a.readable()); std:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. fn driver_shutdown_wakes_pending_race() { // TODO: make this a loom test for _ in 0..100 { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let readable = assert_pending(poll_readable(&afd_a)); let writable = assert_pending(poll_writable(&afd_a)); std::mem::drop(rt); // Attempting to poll readiness when the rt is dropped is an error assert_err!(futures::executor::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
561
620
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
let mut write_ready = rt.block_on(afd_a.writable()).unwrap(); std::mem::drop(rt); write_ready.clear_ready(); } #[test] #[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. fn driver_shutdown_wakes_poll_race() { // TODO: make this a loom test for _ in 0..100 { let rt = rt(); let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
601
660
tokio-rs/tokio:tokio/tests/io_async_fd.rs:17
let listener = std::net::TcpListener::bind(addr).unwrap(); let addr = listener.local_addr().unwrap(); let client = std::net::TcpStream::connect(addr).unwrap(); let client = AsyncFd::with_interest(client, Interest::PRIORITY).unwrap(); let (stream, _) = listener.accept().unwrap(); // Sending out of...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
641
700
tokio-rs/tokio:tokio/tests/io_async_fd.rs:18
b.write_all(b"0").unwrap(); let mut guard = afd_a .ready(Interest::READABLE | Interest::WRITABLE) .await .unwrap(); assert_eq!(guard.ready(), Ready::READABLE | Ready::WRITABLE); guard.clear_ready_matching(Ready::READABLE); assert_eq!(guard.ready(), Ready::WRITABLE); guard...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
681
740
tokio-rs/tokio:tokio/tests/io_async_fd.rs:19
#[tokio::test] #[cfg_attr(miri, ignore)] // No socket in miri. #[cfg(target_os = "linux")] async fn await_error_readiness_timestamping() { use std::net::{Ipv4Addr, SocketAddr}; use tokio::io::{Interest, Ready}; let address_a = SocketAddr::from((Ipv4Addr::LOCALHOST, 0)); let address_b = SocketAddr::fro...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
721
780
tokio-rs/tokio:tokio/tests/io_async_fd.rs:20
let res = unsafe { libc::setsockopt( udp_socket.as_raw_fd(), libc::SOL_SOCKET, libc::SO_TIMESTAMP, &options as *const _ as *const libc::c_void, std::mem::size_of_val(&options) as libc::socklen_t, ) }; if res == -1 { Err(std::io...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
761
820
tokio-rs/tokio:tokio/tests/io_async_fd.rs:21
panic!("{:?}", std::io::Error::last_os_error()); } } // Spawn a separate thread for sending messages tokio::spawn(async move { // Set the destination address. This address is invalid in this context. the OS will notice // that nobody is listening on port this port. Normally this is ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
801
860
tokio-rs/tokio:tokio/tests/io_async_fd.rs:22
let fd = AsyncFd::new(socket).unwrap(); let guard = fd.ready(Interest::ERROR).await.unwrap(); assert_eq!(guard.ready(), Ready::ERROR); } #[derive(Debug, PartialEq, Eq)] struct InvalidSource; impl AsRawFd for InvalidSource { fn as_raw_fd(&self) -> RawFd { -1 } } #[tokio::test] async fn try_ne...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/io_async_fd.rs
841
875
tokio-rs/tokio:tokio/tests/io_async_fd.rs:4
use nix::sys::socket::{self, AddressFamily, SockFlag, SockType}; let (fd_a, fd_b) = socket::socketpair( AddressFamily::Unix, SockType::Stream, None, SockFlag::empty(), ) .expect("socketpair"); let fds = (FileDescriptor { fd: fd_a }, FileDescriptor { fd: fd_b }); set...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
2f899144ed0fb3701bf0996578803ae9df80ebda
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2f899144ed0fb3701bf0996578803ae9df80ebda/tokio/tests/io_async_fd.rs
121
180
tokio-rs/tokio:tokio/tests/io_async_fd.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(unix, feature = "full", not(miri)))] use std::os::unix::io::{AsRawFd, RawFd}; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use std::time::Duration; use std::{ future::Future, io::{self, ErrorKind, Read, Write}, task::{Context, Waker}, }; use nix::u...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/io_async_fd.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_fd.rs:4
use nix::sys::socket::{self, AddressFamily, SockFlag, SockType}; let (fd_a, fd_b) = socket::socketpair( AddressFamily::Unix, SockType::Stream, None, SockFlag::empty(), ) .expect("socketpair"); let fds = (FileDescriptor { fd: fd_a }, FileDescriptor { fd: fd_b }); set...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/io_async_fd.rs
121
180