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/uds_datagram.rs:7 | // Create socket pair
let client = UnixDatagram::bind(&client_path)?;
for _ in 0..5 {
loop {
client.writable().await?;
match client.try_send_to(b"hello world", &server_path) {
Ok(n) => {
assert_eq!(n, 11);
break;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/uds_datagram.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:8 | async fn recv_buf_from() -> std::io::Result<()> {
let tmp = tempfile::tempdir()?;
// Bind each socket to a filesystem path
let tx_path = tmp.path().join("tx");
let tx = UnixDatagram::bind(&tx_path)?;
let rx_path = tmp.path().join("rx");
let rx = UnixDatagram::bind(&rx_path)?;
let bytes = b... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/uds_datagram.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:9 | },
Ok(len) => {
assert_eq!(len, payload.len());
}
}
count += 1;
}
// Read every dgram we sent.
while count > 0 {
let mut recv_buf = Vec::with_capacity(16);
dgram2.readable().await.unwrap();
let len = dgram2.try_recv_buf(&mut r... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/uds_datagram.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:10 | let size = sock2.recv_buf(&mut buff).await?;
let dgram = &buff[..size];
assert_eq!(dgram, bytes);
Ok(())
}
#[tokio::test]
async fn poll_ready() -> io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let server_path = dir.path().join("server.sock");
let client_path = dir.path().join("clien... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/uds_datagram.rs | 361 | 413 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:11 | assert_eq!(n, 11);
assert_eq!(addr.as_pathname(), Some(client_path.as_ref()));
assert_eq!(&buf[0..11], &b"hello world"[..]);
break;
}
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => pan... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/uds_datagram.rs | 401 | 413 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use futures::future::poll_fn;
use tokio::io::ReadBuf;
use tokio::net::UnixDatagram;
use tokio::try_join;
use std::io;
use std::sync::Arc;
async fn echo_server(socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | b31f1a4662e708596fe9cd89853a153b62ec056b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b31f1a4662e708596fe9cd89853a153b62ec056b/tokio/tests/uds_datagram.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:7 | // Create socket pair
let client = UnixDatagram::bind(&client_path)?;
for _ in 0..5 {
loop {
client.writable().await?;
match client.try_send_to(b"hello world", &server_path) {
Ok(n) => {
assert_eq!(n, 11);
break;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/uds_datagram.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:8 | #[tokio::test]
async fn try_recv_buf_never_block() -> io::Result<()> {
let payload = b"PAYLOAD";
let mut count = 0;
let (dgram1, dgram2) = UnixDatagram::pair()?;
// Send until we hit the OS `net.unix.max_dgram_qlen`.
loop {
dgram1.writable().await.unwrap();
match dgram1.try_send(p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/uds_datagram.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:9 | io::ErrorKind::WouldBlock => (),
_ => unreachable!("unexpected error {:?}", err),
}
Ok(())
}
#[tokio::test]
async fn poll_ready() -> io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let server_path = dir.path().join("server.sock");
let client_path = dir.path().join("client.sock");
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/uds_datagram.rs | 321 | 373 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:4 | let path = dir.path().join("split.sock");
let s = Arc::new(UnixDatagram::bind(path.clone())?);
let r = s.clone();
let msg = b"hello";
let ((), ()) = try_join! {
async {
s.send_to(msg, path).await?;
io::Result::Ok(())
},
async {
let mut recv_bu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 57e08e714754420f8b3d8ffe863549d8acf761d0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/uds_datagram.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:5 | }
#[tokio::test]
async fn send_recv_poll() -> std::io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let sender_path = dir.path().join("sender.sock");
let receiver_path = dir.path().join("receiver.sock");
let sender = UnixDatagram::bind(&sender_path)?;
let receiver = UnixDatagram::bind(&rec... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 57e08e714754420f8b3d8ffe863549d8acf761d0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/uds_datagram.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use futures::future::poll_fn;
use tokio::io::ReadBuf;
use tokio::net::UnixDatagram;
use tokio::try_join;
use std::io;
use std::sync::Arc;
async fn echo_server(socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:2 | let mut recv_buf = [0u8; 16];
let len = socket.recv(&mut recv_buf[..]).await?;
assert_eq!(&recv_buf[..len], b"ECHO");
}
Ok(())
}
#[tokio::test]
async fn echo_from() -> io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let server_path = dir.path().join("server.sock");
let cli... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:3 | let mut count = 0;
let (dgram1, dgram2) = UnixDatagram::pair()?;
// Send until we hit the OS `net.unix.max_dgram_qlen`.
loop {
dgram1.writable().await.unwrap();
match dgram1.try_send(payload) {
Err(err) => match (err.kind(), err.raw_os_error()) {
(io::ErrorKind... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:4 | #[tokio::test]
async fn split() -> std::io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("split.sock");
let s = Arc::new(UnixDatagram::bind(path.clone())?);
let r = s.clone();
let msg = b"hello";
let ((), ()) = try_join! {
async {
s.send_to... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:5 | assert_eq!(read.filled(), msg);
assert_eq!(addr.as_pathname(), Some(sender_path.as_ref()));
Ok(())
}
#[tokio::test]
async fn send_recv_poll() -> std::io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let sender_path = dir.path().join("sender.sock");
let receiver_path = dir.path().join("recei... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:6 | for _ in 0..5 {
loop {
client.writable().await?;
match client.try_send_to(b"hello world", &server_path) {
Ok(n) => {
assert_eq!(n, 11);
break;
}
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock =>... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:7 | let client_path = dir.path().join("client.sock");
// Create listener
let server = UnixDatagram::bind(&server_path)?;
// Create socket pair
let client = UnixDatagram::bind(&client_path)?;
for _ in 0..5 {
loop {
client.writable().await?;
match client.try_send_to(b"h... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:8 | Ok(())
}
// Even though we use sync non-blocking io we still need a reactor.
#[tokio::test]
async fn try_recv_buf_never_block() -> io::Result<()> {
let payload = b"PAYLOAD";
let mut count = 0;
let (dgram1, dgram2) = UnixDatagram::pair()?;
// Send until we hit the OS `net.unix.max_dgram_qlen`.
loo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:9 | let mut recv_buf = vec![0; 16];
let err = dgram2.try_recv_from(&mut recv_buf).unwrap_err();
match err.kind() {
io::ErrorKind::WouldBlock => (),
_ => unreachable!("unexpected error {:?}", err),
}
Ok(())
}
#[tokio::test]
async fn poll_ready() -> io::Result<()> {
let dir = tempfile::t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 321 | 377 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:10 | let mut buf = Vec::with_capacity(512);
match server.try_recv_buf_from(&mut buf) {
Ok((n, addr)) => {
assert_eq!(n, 11);
assert_eq!(addr.as_pathname(), Some(client_path.as_ref()));
assert_eq!(&buf[0..11], &b"hello world"[..]);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | d32acd97eb006a2591c1734747c320322b29a31e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d32acd97eb006a2591c1734747c320322b29a31e/tokio/tests/uds_datagram.rs | 361 | 377 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:8 | Ok(())
}
// Even though we use sync non-blocking io we still need a reactor.
#[tokio::test]
async fn try_recv_buf_never_block() -> io::Result<()> {
let payload = b"PAYLOAD";
let mut count = 0;
let (dgram1, dgram2) = UnixDatagram::pair()?;
// Send until we hit the OS `net.unix.max_dgram_qlen`.
loo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 3fd88dac644728a9ae9ffa8bc518b090d90ed51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3fd88dac644728a9ae9ffa8bc518b090d90ed51b/tokio/tests/uds_datagram.rs | 281 | 330 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:9 | let mut recv_buf = vec![0; 16];
let err = dgram2.try_recv_from(&mut recv_buf).unwrap_err();
match err.kind() {
io::ErrorKind::WouldBlock => (),
_ => unreachable!("unexpected error {:?}", err),
}
Ok(())
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 3fd88dac644728a9ae9ffa8bc518b090d90ed51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3fd88dac644728a9ae9ffa8bc518b090d90ed51b/tokio/tests/uds_datagram.rs | 321 | 330 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:2 | let mut recv_buf = [0u8; 16];
let len = socket.recv(&mut recv_buf[..]).await?;
assert_eq!(&recv_buf[..len], b"ECHO");
}
Ok(())
}
#[tokio::test]
async fn echo_from() -> io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let server_path = dir.path().join("server.sock");
let cli... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_datagram.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:3 | let mut count = 0;
let (dgram1, dgram2) = UnixDatagram::pair()?;
// Send until we hit the OS `net.unix.max_dgram_qlen`.
loop {
dgram1.writable().await.unwrap();
match dgram1.try_send(payload) {
Err(err) => match err.kind() {
io::ErrorKind::WouldBlock | io::Erro... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_datagram.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:5 | Ok(())
}
#[tokio::test]
async fn send_recv_poll() -> std::io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let sender_path = dir.path().join("sender.sock");
let receiver_path = dir.path().join("receiver.sock");
let sender = UnixDatagram::bind(&sender_path)?;
let receiver = UnixDatagram::bi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_datagram.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:7 | let server = UnixDatagram::bind(&server_path)?;
// Create socket pair
let client = UnixDatagram::bind(&client_path)?;
for _ in 0..5 {
loop {
client.writable().await?;
match client.try_send_to(b"hello world", &server_path) {
Ok(n) => {
as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_datagram.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:8 | // Even though we use sync non-blocking io we still need a reactor.
#[tokio::test]
async fn try_recv_buf_never_block() -> io::Result<()> {
let payload = b"PAYLOAD";
let mut count = 0;
let (dgram1, dgram2) = UnixDatagram::pair()?;
// Send until we hit the OS `net.unix.max_dgram_qlen`.
loop {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_datagram.rs | 281 | 324 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:6 | client.writable().await?;
match client.try_send_to(b"hello world", &server_path) {
Ok(n) => {
assert_eq!(n, 11);
break;
}
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 2a30e13f38b864807f9ad92023e91b060a6227a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2a30e13f38b864807f9ad92023e91b060a6227a4/tokio/tests/uds_datagram.rs | 201 | 232 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::net::UnixDatagram;
use tokio::try_join;
use std::io;
use std::sync::Arc;
async fn echo_server(socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop {
let (len, peer_addr) = socket.recv_from(&mut... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | ee597347c5e612611142ece09c79e55f2d243590 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ee597347c5e612611142ece09c79e55f2d243590/tokio/tests/uds_datagram.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:2 | assert_eq!(&recv_buf[..len], b"ECHO");
}
Ok(())
}
#[tokio::test]
async fn echo_from() -> io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let server_path = dir.path().join("server.sock");
let client_path = dir.path().join("client.sock");
let server_socket = UnixDatagram::bind(server_p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | ee597347c5e612611142ece09c79e55f2d243590 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ee597347c5e612611142ece09c79e55f2d243590/tokio/tests/uds_datagram.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:3 | let (dgram1, dgram2) = UnixDatagram::pair()?;
// Send until we hit the OS `net.unix.max_dgram_qlen`.
loop {
match dgram1.try_send(payload) {
Err(err) => match err.kind() {
io::ErrorKind::WouldBlock | io::ErrorKind::Other => break,
_ => unreachable!("unexpecte... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | ee597347c5e612611142ece09c79e55f2d243590 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ee597347c5e612611142ece09c79e55f2d243590/tokio/tests/uds_datagram.rs | 81 | 136 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:4 | let msg = b"hello";
let ((), ()) = try_join! {
async {
s.send_to(msg, path).await?;
io::Result::Ok(())
},
async {
let mut recv_buf = [0u8; 32];
let (len, _) = r.recv_from(&mut recv_buf[..]).await?;
assert_eq!(&recv_buf[..len], msg);... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | ee597347c5e612611142ece09c79e55f2d243590 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ee597347c5e612611142ece09c79e55f2d243590/tokio/tests/uds_datagram.rs | 121 | 136 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:2 | assert_eq!(&recv_buf[..len], b"ECHO");
}
Ok(())
}
#[tokio::test]
async fn echo_from() -> io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let server_path = dir.path().join("server.sock");
let client_path = dir.path().join("client.sock");
let server_socket = UnixDatagram::bind(server_p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 1e585ccb516c8dc7c13cbc3d50f8ca49260b9617 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/tests/uds_datagram.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:3 | let (mut dgram1, mut dgram2) = UnixDatagram::pair()?;
// Send until we hit the OS `net.unix.max_dgram_qlen`.
loop {
match dgram1.try_send(payload) {
Err(err) => match err.kind() {
io::ErrorKind::WouldBlock | io::ErrorKind::Other => break,
_ => unreachable!("u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 1e585ccb516c8dc7c13cbc3d50f8ca49260b9617 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/tests/uds_datagram.rs | 81 | 136 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::net::UnixDatagram;
use tokio::try_join;
use std::io;
use std::sync::Arc;
async fn echo_server(socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop {
let (len, peer_addr) = socket.recv_from(&mut... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | a0557840eb424e174bf81a0175c40f9e176a2cc2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0557840eb424e174bf81a0175c40f9e176a2cc2/tokio/tests/uds_datagram.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:2 | assert_eq!(&recv_buf[..len], b"ECHO");
}
Ok(())
}
// Even though we use sync non-blocking io we still need a reactor.
#[tokio::test]
async fn try_send_recv_never_block() -> io::Result<()> {
let mut recv_buf = [0u8; 16];
let payload = b"PAYLOAD";
let mut count = 0;
let (mut dgram1, mut dgram2)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | a0557840eb424e174bf81a0175c40f9e176a2cc2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0557840eb424e174bf81a0175c40f9e176a2cc2/tokio/tests/uds_datagram.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:3 | _ => unreachable!("unexpected error {:?}", err),
}
Ok(())
}
#[tokio::test]
async fn split() -> std::io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("split.sock");
let s = Arc::new(UnixDatagram::bind(path.clone())?);
let r = s.clone();
let msg = b"hello"... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | a0557840eb424e174bf81a0175c40f9e176a2cc2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0557840eb424e174bf81a0175c40f9e176a2cc2/tokio/tests/uds_datagram.rs | 81 | 109 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::net::UnixDatagram;
use tokio::try_join;
use std::io;
async fn echo_server(mut socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop {
let (len, peer_addr) = socket.recv_from(&mut recv_buf[..]).a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 2d97d5ad15a19665615ed38219d3b7798df7e250 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d97d5ad15a19665615ed38219d3b7798df7e250/tokio/tests/uds_datagram.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:2 | }
Ok(())
}
// Even though we use sync non-blocking io we still need a reactor.
#[tokio::test]
async fn try_send_recv_never_block() -> io::Result<()> {
let mut recv_buf = [0u8; 16];
let payload = b"PAYLOAD";
let mut count = 0;
let (mut dgram1, mut dgram2) = UnixDatagram::pair()?;
// Send unti... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 2d97d5ad15a19665615ed38219d3b7798df7e250 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d97d5ad15a19665615ed38219d3b7798df7e250/tokio/tests/uds_datagram.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:3 | }
Ok(())
}
#[tokio::test]
async fn split() -> std::io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("split.sock");
let socket = UnixDatagram::bind(path.clone())?;
let (mut r, mut s) = socket.into_split();
let msg = b"hello";
let ((), ()) = try_join! {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 2d97d5ad15a19665615ed38219d3b7798df7e250 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d97d5ad15a19665615ed38219d3b7798df7e250/tokio/tests/uds_datagram.rs | 81 | 133 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:4 | async fn reunite_error() -> std::io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("reunit.sock");
let dir = tempfile::tempdir().unwrap();
let path1 = dir.path().join("reunit.sock");
let socket = UnixDatagram::bind(path)?;
let socket1 = UnixDatagram::bind(path1)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 2d97d5ad15a19665615ed38219d3b7798df7e250 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d97d5ad15a19665615ed38219d3b7798df7e250/tokio/tests/uds_datagram.rs | 121 | 133 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::net::UnixDatagram;
use tokio::try_join;
use std::io;
async fn echo_server(mut socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop {
let (len, peer_addr) = socket.recv_from(&mut recv_buf[..]).a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | ff7125ec7b4fe009b80cc033edbf338883eb0435 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ff7125ec7b4fe009b80cc033edbf338883eb0435/tokio/tests/uds_datagram.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::net::UnixDatagram;
use std::io;
async fn echo_server(mut socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop {
let (len, peer_addr) = socket.recv_from(&mut recv_buf[..]).await?;
if let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 4ddc4371709562d2bd1d0373f0555f7c31926e53 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4ddc4371709562d2bd1d0373f0555f7c31926e53/tokio/tests/uds_datagram.rs | 1 | 43 |
tokio-rs/tokio:tokio/tests/uds_datagram.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::net::unix::*;
use std::io;
async fn echo_server(mut socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop {
let (len, peer_addr) = socket.recv_from(&mut recv_buf[..]).await?;
if let Some... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_datagram.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/uds_datagram.rs | 1 | 43 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use futures::future::try_join;
use std::io;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::UnixSocket,
};
#[tokio::test]
#[cfg_attr(miri, ignore)] // No `socket` in miri.
async fn datagram_echo_server() -> io::Result<()> {
let dir = ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_socket.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:2 | let socket = socket.datagram()?;
socket.connect(server_path)?;
socket.send(b"ECHO").await?;
let mut recv_buf = [0u8; 16];
let len = socket.recv(&mut recv_buf[..]).await?;
assert_eq!(&recv_buf[..len], b"ECHO");
}
Ok(())
}
#[tokio::test]
#[cfg_attr(miri, ignore)] // No ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_socket.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:3 | // Write to the client.
client.write_all(b"hello").await?;
drop(client);
// Read from the server.
let mut buf = vec![];
server.read_to_end(&mut buf).await?;
assert_eq!(&buf, b"hello");
let len = server.read(&mut buf).await?;
assert_eq!(len, 0);
Ok(())
}
#[tokio::test]
#[cfg_attr(mi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_socket.rs | 81 | 121 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))]
use futures::future::try_join;
use std::io;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::UnixSocket,
};
#[tokio::test]
async fn datagram_echo_server() -> io::Result<()> {
let dir = tempfile::tempdir().unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_socket.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:2 | let socket = socket.datagram()?;
socket.connect(server_path)?;
socket.send(b"ECHO").await?;
let mut recv_buf = [0u8; 16];
let len = socket.recv(&mut recv_buf[..]).await?;
assert_eq!(&recv_buf[..len], b"ECHO");
}
Ok(())
}
#[tokio::test]
async fn listen_and_stream() -> ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_socket.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:3 | client.write_all(b"hello").await?;
drop(client);
// Read from the server.
let mut buf = vec![];
server.read_to_end(&mut buf).await?;
assert_eq!(&buf, b"hello");
let len = server.read(&mut buf).await?;
assert_eq!(len, 0);
Ok(())
}
#[tokio::test]
async fn assert_usage() -> std::io::Resul... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_socket.rs | 81 | 119 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use futures::future::try_join;
use std::io;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::UnixSocket,
};
#[tokio::test]
async fn datagram_echo_server() -> io::Result<()> {
let dir = tempfile::tempdir().unwrap();
let server_path ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | ec3038357f8dbbae0ab4daf55ff27937ad42abb2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ec3038357f8dbbae0ab4daf55ff27937ad42abb2/tokio/tests/uds_socket.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:2 | socket.connect(server_path)?;
socket.send(b"ECHO").await?;
let mut recv_buf = [0u8; 16];
let len = socket.recv(&mut recv_buf[..]).await?;
assert_eq!(&recv_buf[..len], b"ECHO");
}
Ok(())
}
#[tokio::test]
async fn listen_and_stream() -> std::io::Result<()> {
let dir = tempfi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | ec3038357f8dbbae0ab4daf55ff27937ad42abb2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ec3038357f8dbbae0ab4daf55ff27937ad42abb2/tokio/tests/uds_socket.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_socket.rs:3 | drop(client);
// Read from the server.
let mut buf = vec![];
server.read_to_end(&mut buf).await?;
assert_eq!(&buf, b"hello");
let len = server.read(&mut buf).await?;
assert_eq!(len, 0);
Ok(())
}
#[tokio::test]
async fn assert_usage() -> std::io::Result<()> {
let datagram_socket = UnixS... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_socket.rs | MIT | ec3038357f8dbbae0ab4daf55ff27937ad42abb2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ec3038357f8dbbae0ab4daf55ff27937ad42abb2/tokio/tests/uds_socket.rs | 81 | 118 |
tokio-rs/tokio:tokio/tests/uds_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))] // No `socket` in miri.
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tokio::net::UnixStream;
/// Checks that `UnixStream` can be split into a read half and a write half using
/// `UnixStream::split` and `... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_split.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_split.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/uds_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))]
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tokio::net::UnixStream;
/// Checks that `UnixStream` can be split into a read half and a write half using
/// `UnixStream::split` and `UnixStream::split_mut`.
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_split.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_split.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/uds_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tokio::net::UnixStream;
/// Checks that `UnixStream` can be split into a read half and a write half using
/// `UnixStream::split` and `UnixStream::split_mut`.
///
/// Verifies th... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_split.rs | MIT | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/uds_split.rs | 1 | 43 |
tokio-rs/tokio:tokio/tests/uds_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::net::UnixStream;
use tokio::prelude::*;
/// Checks that `UnixStream` can be split into a read half and a write half using
/// `UnixStream::split` and `UnixStream::split_mut`.
///
/// Verifies that the implementation of `AsyncWrite::poll_shu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_split.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/uds_split.rs | 1 | 43 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
#![cfg(not(miri))] // No socket in miri.
use std::io;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
use std::task::Poll;
use tokio::io::{AsyncReadExt, AsyncW... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:2 | let len = server.read(&mut buf).await?;
assert_eq!(len, 0);
Ok(())
}
#[tokio::test]
async fn shutdown() -> std::io::Result<()> {
let dir = tempfile::Builder::new()
.prefix("tokio-uds-tests")
.tempdir()
.unwrap();
let sock_path = dir.path().join("connect.sock");
let listener... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:3 | let (server, _) = listener.accept().await?;
let mut written = msg.to_vec();
// Track the server receiving data
let mut readable = task::spawn(server.readable());
assert_pending!(readable.poll());
// Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
/... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:4 | while i < read.len() {
server.readable().await?;
match server.try_read(&mut read[i..]) {
Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!("error = {e:?}"),
}
}
assert_e... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:5 | let mut i = 0;
while i < read.len() {
server.readable().await?;
let mut bufs: Vec<_> = read[i..]
.chunks_mut(0x10000)
.map(io::IoSliceMut::new)
.collect();
match server.try_read_vectored(&mut bufs) {
Ok(n) => i... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:6 | let accept = listener.accept();
let connect = UnixStream::connect(&bind_path);
let ((server, _), client) = assert_ok!(try_join(accept, connect).await);
(client, server)
}
macro_rules! assert_readable_by_polling {
($stream:expr) => {
assert_ok!(poll_fn(|cx| $stream.poll_read_ready(cx)).await);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:7 | #[tokio::test]
async fn poll_read_ready() {
let (mut client, mut server) = create_pair().await;
// Initial state - not readable.
assert_not_readable_by_polling!(server);
// There is data in the buffer - readable.
assert_ok!(client.write_all(b"ping").await);
assert_readable_by_polling!(server);... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:8 | let mut buf = vec![0u8; 1024 * 1024];
loop {
match stream.try_read(&mut buf) {
Ok(_) => (),
Err(err) => {
assert_eq!(err.kind(), io::ErrorKind::WouldBlock);
break;
}
}
}
}
fn write_until_pending(stream: &mut UnixStream) {
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:9 | // Track the server receiving data
let mut readable = task::spawn(server.readable());
assert_pending!(readable.poll());
// Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
// The task should be notified
while !readable.is_woken() {
tokio::task::y... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:10 | match server.try_read_buf(&mut read) {
Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!("error = {e:?}"),
}
}
assert_eq!(read, written);
}
// Now, we listen for shutdown
drop(clien... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:11 | // Poll `connect` once.
poll_fn(|cx| {
use std::future::Future;
assert_pending!(connect.as_mut().poll(cx));
Poll::Ready(())
})
.await;
drop(listener);
let err = connect.await.unwrap_err();
let errno = err.kind();
assert!(
// As far as I can tell, whether we... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/uds_stream.rs | 401 | 446 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
#![cfg(not(miri))]
use std::io;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
use std::task::Poll;
use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest};
us... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/uds_stream.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:3 | let (server, _) = listener.accept().await?;
let mut written = msg.to_vec();
// Track the server receiving data
let mut readable = task::spawn(server.readable());
assert_pending!(readable.poll());
// Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
/... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_stream.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:4 | while i < read.len() {
server.readable().await?;
match server.try_read(&mut read[i..]) {
Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!("error = {:?}", e),
}
}
assert... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_stream.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:5 | let mut i = 0;
while i < read.len() {
server.readable().await?;
let mut bufs: Vec<_> = read[i..]
.chunks_mut(0x10000)
.map(io::IoSliceMut::new)
.collect();
match server.try_read_vectored(&mut bufs) {
Ok(n) => i... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_stream.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:9 | // Track the server receiving data
let mut readable = task::spawn(server.readable());
assert_pending!(readable.poll());
// Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
// The task should be notified
while !readable.is_woken() {
tokio::task::y... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_stream.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:10 | match server.try_read_buf(&mut read) {
Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!("error = {:?}", e),
}
}
assert_eq!(read, written);
}
// Now, we listen for shutdown
drop(cli... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/uds_stream.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
use std::io;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
use std::task::Poll;
use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest};
use tokio::net::{Unix... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:2 | assert_eq!(len, 0);
Ok(())
}
#[tokio::test]
async fn shutdown() -> std::io::Result<()> {
let dir = tempfile::Builder::new()
.prefix("tokio-uds-tests")
.tempdir()
.unwrap();
let sock_path = dir.path().join("connect.sock");
let listener = UnixListener::bind(&sock_path)?;
let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:3 | let (server, _) = listener.accept().await?;
let mut written = msg.to_vec();
// Track the server receiving data
let mut readable = task::spawn(server.readable());
assert_pending!(readable.poll());
// Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
/... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:4 | while i < read.len() {
server.readable().await?;
match server.try_read(&mut read[i..]) {
Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!("error = {:?}", e),
}
}
assert... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:5 | while i < read.len() {
server.readable().await?;
let mut bufs: Vec<_> = read[i..]
.chunks_mut(0x10000)
.map(io::IoSliceMut::new)
.collect();
match server.try_read_vectored(&mut bufs) {
Ok(n) => i += n,
E... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:6 | let accept = listener.accept();
let connect = UnixStream::connect(&bind_path);
let ((server, _), client) = assert_ok!(try_join(accept, connect).await);
(client, server)
}
macro_rules! assert_readable_by_polling {
($stream:expr) => {
assert_ok!(poll_fn(|cx| $stream.poll_read_ready(cx)).await);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:7 | async fn poll_read_ready() {
let (mut client, mut server) = create_pair().await;
// Initial state - not readable.
assert_not_readable_by_polling!(server);
// There is data in the buffer - readable.
assert_ok!(client.write_all(b"ping").await);
assert_readable_by_polling!(server);
// Readab... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:8 | loop {
match stream.try_read(&mut buf) {
Ok(_) => (),
Err(err) => {
assert_eq!(err.kind(), io::ErrorKind::WouldBlock);
break;
}
}
}
}
fn write_until_pending(stream: &mut UnixStream) {
let buf = vec![0u8; 1024 * 1024];
loop ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:9 | // Track the server receiving data
let mut readable = task::spawn(server.readable());
assert_pending!(readable.poll());
// Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
// The task should be notified
while !readable.is_woken() {
tokio::task::y... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:10 | match server.try_read_buf(&mut read) {
Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!("error = {:?}", e),
}
}
assert_eq!(read, written);
}
// Now, we listen for shutdown
drop(cli... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0cea36fa3d60e7294a8e24a00b69c60b26c88c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0cea36fa3d60e7294a8e24a00b69c60b26c88c3d/tokio/tests/uds_stream.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
use std::io;
use std::task::Poll;
use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest};
use tokio::net::{UnixListener, UnixStream};
use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task};
use futures::future::{poll_fn, try_join};
#[tok... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:2 | #[tokio::test]
async fn shutdown() -> std::io::Result<()> {
let dir = tempfile::Builder::new()
.prefix("tokio-uds-tests")
.tempdir()
.unwrap();
let sock_path = dir.path().join("connect.sock");
let listener = UnixListener::bind(&sock_path)?;
let accept = listener.accept();
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:3 | let mut readable = task::spawn(server.readable());
assert_pending!(readable.poll());
// Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
// The task should be notified
while !readable.is_woken() {
tokio::task::yield_now().await;
}
// Fill th... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:4 | Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!("error = {:?}", e),
}
}
assert_eq!(read, written);
}
written.clear();
client.writable().await.unwrap();
// Fill the write buffer using vectore... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:5 | let mut bufs: Vec<_> = read[i..]
.chunks_mut(0x10000)
.map(io::IoSliceMut::new)
.collect();
match server.try_read_vectored(&mut bufs) {
Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:6 | (client, server)
}
macro_rules! assert_readable_by_polling {
($stream:expr) => {
assert_ok!(poll_fn(|cx| $stream.poll_read_ready(cx)).await);
};
}
macro_rules! assert_not_readable_by_polling {
($stream:expr) => {
poll_fn(|cx| {
assert_pending!($stream.poll_read_ready(cx));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:7 | assert_not_readable_by_polling!(server);
// There is data in the buffer - readable.
assert_ok!(client.write_all(b"ping").await);
assert_readable_by_polling!(server);
// Readable until calls to `poll_read` return `Poll::Pending`.
let mut buf = [0u8; 4];
assert_ok!(server.read_exact(&mut buf).aw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:8 | assert_eq!(err.kind(), io::ErrorKind::WouldBlock);
break;
}
}
}
}
fn write_until_pending(stream: &mut UnixStream) {
let buf = vec![0u8; 1024 * 1024];
loop {
match stream.try_write(&buf) {
Ok(_) => (),
Err(err) => {
assert_e... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:9 | // Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
// The task should be notified
while !readable.is_woken() {
tokio::task::yield_now().await;
}
// Fill the write buffer
loop {
// Still ready
let mut writable = task::spawn(client... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:10 | }
}
assert_eq!(read, written);
}
// Now, we listen for shutdown
drop(client);
loop {
let ready = server.ready(Interest::READABLE).await?;
if ready.is_read_closed() {
break;
} else {
tokio::task::yield_now().await;
}
}
O... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:11 | assert_pending!(connect.as_mut().poll(cx));
Poll::Ready(())
})
.await;
drop(listener);
let err = connect.await.unwrap_err();
assert_eq!(err.kind(), io::ErrorKind::ConnectionReset);
Ok(())
}
// test for https://github.com/tokio-rs/tokio/issues/6767
#[tokio::test]
#[cfg(any(target_os = ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b2ea40bb543a5116109b37e1fd64713c116e4312 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ea40bb543a5116109b37e1fd64713c116e4312/tokio/tests/uds_stream.rs | 401 | 424 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:10 | }
}
assert_eq!(read, written);
}
// Now, we listen for shutdown
drop(client);
loop {
let ready = server.ready(Interest::READABLE).await?;
if ready.is_read_closed() {
break;
} else {
tokio::task::yield_now().await;
}
}
O... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 56f3f40c1567b906279f0d6f8a34c146616708cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/56f3f40c1567b906279f0d6f8a34c146616708cf/tokio/tests/uds_stream.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:11 | assert_pending!(connect.as_mut().poll(cx));
Poll::Ready(())
})
.await;
drop(listener);
let err = connect.await.unwrap_err();
let errno = err.kind();
assert!(
// As far as I can tell, whether we see ECONNREFUSED or ECONNRESET here
// seems relatively inconsistent, at lea... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 56f3f40c1567b906279f0d6f8a34c146616708cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/56f3f40c1567b906279f0d6f8a34c146616708cf/tokio/tests/uds_stream.rs | 401 | 422 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:10 | }
}
assert_eq!(read, written);
}
// Now, we listen for shutdown
drop(client);
loop {
let ready = server.ready(Interest::READABLE).await?;
if ready.is_read_closed() {
break;
} else {
tokio::task::yield_now().await;
}
}
O... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 702d6dccc948b6a460caa52da4e4c03b252c5c3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/702d6dccc948b6a460caa52da4e4c03b252c5c3b/tokio/tests/uds_stream.rs | 361 | 411 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:11 | assert_pending!(connect.as_mut().poll(cx));
Poll::Ready(())
})
.await;
drop(listener);
let err = connect.await.unwrap_err();
assert_eq!(err.kind(), io::ErrorKind::ConnectionReset);
Ok(())
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 702d6dccc948b6a460caa52da4e4c03b252c5c3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/702d6dccc948b6a460caa52da4e4c03b252c5c3b/tokio/tests/uds_stream.rs | 401 | 411 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.