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/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No `socket` on miri.
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, oneshot};
use tokio_test::assert_ok;
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2 | (ip_port_tuple, ("127.0.0.1".parse::<IpAddr>().unwrap(), 0)),
}
use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio_stream::{Stream, StreamExt};
struct TrackPolls<'a> {
npolls: Arc<AtomicUsize>,
listener: &'a mut TcpListener,
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/tcp_accept.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3 | accepted_tx.send(()).unwrap();
}
});
let npolls = assert_ok!(rx.await);
tokio::task::yield_now().await;
// should have been polled exactly once: the initial poll
assert_eq!(npolls.load(SeqCst), 1);
let _ = assert_ok!(TcpStream::connect(&addr).await);
accepted_rx.recv().await.unwra... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/tcp_accept.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:4 | tokio::pin!(accept);
let mut polled = false;
poll_fn(|cx| {
if !polled {
polled = true;
assert!(Pin::new(&mut accept).poll(cx).is_pending());
pending_tx.send(()).unwrap();
Poll::Pending
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/tcp_accept.rs | 121 | 157 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, oneshot};
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2 | }
use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio_stream::{Stream, StreamExt};
struct TrackPolls<'a> {
npolls: Arc<AtomicUsize>,
listener: &'a mut TcpListener,
}
impl<'a> Stream for TrackPolls<'a> {
type Item = io::Res... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_accept.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3 | }
});
let npolls = assert_ok!(rx.await);
tokio::task::yield_now().await;
// should have been polled exactly once: the initial poll
assert_eq!(npolls.load(SeqCst), 1);
let _ = assert_ok!(TcpStream::connect(&addr).await);
accepted_rx.recv().await.unwrap();
// should have been polled tw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_accept.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:4 | let mut polled = false;
poll_fn(|cx| {
if !polled {
polled = true;
assert!(Pin::new(&mut accept).poll(cx).is_pending());
pending_tx.send(()).unwrap();
Poll::Pending
} else if connected.load(SeqCs... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_accept.rs | 121 | 156 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, oneshot};
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:ident, $tar... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2 | }
use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio_stream::{Stream, StreamExt};
struct TrackPolls<'a> {
npolls: Arc<AtomicUsize>,
listener: &'a mut TcpListener,
}
impl<'a> Stream for TrackPolls<'a> {
type Item = io::Res... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/tcp_accept.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3 | }
});
let npolls = assert_ok!(rx.await);
tokio::task::yield_now().await;
// should have been polled exactly once: the initial poll
assert_eq!(npolls.load(SeqCst), 1);
let _ = assert_ok!(TcpStream::connect(&addr).await);
accepted_rx.recv().await.unwrap();
// should have been polled tw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/tcp_accept.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, oneshot};
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:ident, $target:expr... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, oneshot};
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:ident, $target:expr),)*) => {
$(
#[tokio::test]
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, oneshot};
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:ident, $target:expr),)*) => {
$(
#[tokio::test]
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2 | }
use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio::stream::{Stream, StreamExt};
struct TrackPolls<'a> {
npolls: Arc<AtomicUsize>,
listener: &'a mut TcpListener,
}
impl<'a> Stream for TrackPolls<'a> {
type Item = io::Re... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/tcp_accept.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3 | }
});
let npolls = assert_ok!(rx.await);
tokio::task::yield_now().await;
// should have been polled exactly once: the initial poll
assert_eq!(npolls.load(SeqCst), 1);
let _ = assert_ok!(TcpStream::connect(&addr).await);
accepted_rx.next().await.unwrap();
// should have been polled tw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/tcp_accept.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, oneshot};
use tokio_test::assert_ok;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:ident, $target:expr),)*) => {
$(
#[tokio::test]
asy... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 6b6e76080afc92450238df69c4edc12ee5f7518d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6b6e76080afc92450238df69c4edc12ee5f7518d/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2 | use pin_project_lite::pin_project;
use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio::stream::{Stream, StreamExt};
pin_project! {
struct TrackPolls<S> {
npolls: Arc<AtomicUsize>,
#[pin]
s: S,
}
}
impl<... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 6b6e76080afc92450238df69c4edc12ee5f7518d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6b6e76080afc92450238df69c4edc12ee5f7518d/tokio/tests/tcp_accept.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3 | npolls: Arc::new(AtomicUsize::new(0)),
s: listener.incoming(),
};
assert_ok!(tx.send(Arc::clone(&incoming.npolls)));
while incoming.next().await.is_some() {
accepted_tx.send(()).unwrap();
}
});
let npolls = assert_ok!(rx.await);
tokio::task::yield_now... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 6b6e76080afc92450238df69c4edc12ee5f7518d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6b6e76080afc92450238df69c4edc12ee5f7518d/tokio/tests/tcp_accept.rs | 81 | 101 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, oneshot};
use tokio_test::assert_ok;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:ident, $target:expr),)*) => {
$(
#[tokio::test]
asy... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 4010335c84517571e9b2d13f66f7c72170493622 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2 | use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio::stream::{Stream, StreamExt};
struct TrackPolls<S> {
npolls: Arc<AtomicUsize>,
s: S,
}
impl<S> Stream for TrackPolls<S>
where
S: Stream,
{
type Item = S::Item;
fn ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 4010335c84517571e9b2d13f66f7c72170493622 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/tcp_accept.rs | 41 | 99 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3 | };
assert_ok!(tx.send(Arc::clone(&incoming.npolls)));
while incoming.next().await.is_some() {
accepted_tx.send(()).unwrap();
}
});
let npolls = assert_ok!(rx.await);
tokio::task::yield_now().await;
// should have been polled exactly once: the initial poll
assert... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 4010335c84517571e9b2d13f66f7c72170493622 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/tcp_accept.rs | 81 | 99 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2 | use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio::stream::{Stream, StreamExt};
struct TrackPolls<S> {
npolls: Arc<AtomicUsize>,
s: S,
}
impl<S> Stream for TrackPolls<S>
where
S: Stream,
{
type Item = S::Item;
fn ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 2eed6d00f551c074f48054a1412fa85e9fbe13f7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2eed6d00f551c074f48054a1412fa85e9fbe13f7/tokio/tests/tcp_accept.rs | 41 | 99 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3 | };
assert_ok!(tx.send(Arc::clone(&incoming.npolls)));
while let Some(_) = incoming.next().await {
accepted_tx.send(()).unwrap();
}
});
let npolls = assert_ok!(rx.await);
tokio::task::yield_now().await;
// should have been polled exactly once: the initial poll
as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 2eed6d00f551c074f48054a1412fa85e9fbe13f7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2eed6d00f551c074f48054a1412fa85e9fbe13f7/tokio/tests/tcp_accept.rs | 81 | 99 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:ident, $target:expr),)*) => {
$(
#[tokio::test]
async fn $i... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | c1232a65207e3b2d42d82b9144658f6293287089 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c1232a65207e3b2d42d82b9144658f6293287089/tokio/tests/tcp_accept.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2 | use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio::stream::{Stream, StreamExt};
struct TrackPolls<S> {
npolls: Arc<AtomicUsize>,
s: S,
}
impl<S> Stream for TrackPolls<S>
where
S: Stream,
{
type Item = S::Item;
fn ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | c1232a65207e3b2d42d82b9144658f6293287089 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c1232a65207e3b2d42d82b9144658f6293287089/tokio/tests/tcp_accept.rs | 41 | 96 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3 | assert_ok!(tx.send(Arc::clone(&incoming.npolls)));
while let Some(_) = incoming.next().await {}
});
let npolls = assert_ok!(rx.await);
tokio::task::yield_now().await;
// should have been polled exactly once: the initial poll
assert_eq!(npolls.load(SeqCst), 1);
let _ = assert_ok!(TcpSt... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | c1232a65207e3b2d42d82b9144658f6293287089 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c1232a65207e3b2d42d82b9144658f6293287089/tokio/tests/tcp_accept.rs | 81 | 96 |
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use std::net::{IpAddr, SocketAddr};
macro_rules! test_accept {
($(($ident:ident, $target:expr),)*) => {
$(
#[tokio::test]
async fn $i... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_accept.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/tcp_accept.rs | 1 | 40 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
// WASIp1 doesn't support bind
// No `socket` on miri.
#![cfg(all(
feature = "net",
feature = "macros",
feature = "rt",
feature = "io-util",
not(all(target_os = "wasi", target_env = "p1")),
not(miri)
))]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::onesh... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:2 | assert_ok!(theirs.local_addr()),
assert_ok!(mine.peer_addr())
);
}
#[tokio::test]
async fn connect_v6() {
let srv = assert_ok!(TcpListener::bind("[::1]:0").await);
let addr = assert_ok!(srv.local_addr());
assert!(addr.is_ipv6());
let (tx, rx) = oneshot::channel();
tokio::spawn(async m... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_connect.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:3 | };
let client = async {
assert_ok!(TcpStream::connect(addr).await);
};
join!(server, client);
}
#[tokio::test]
async fn connect_addr_ip_str_slice() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let addr = assert_ok!(srv.local_addr());
let addr = format!("127.0.0.1:{}... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_connect.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:4 | assert_ok!(srv.accept().await);
};
let client = async {
assert_ok!(TcpStream::connect(addr).await);
};
join!(server, client);
}
#[tokio::test]
async fn connect_addr_ip_port_tuple() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let addr = assert_ok!(srv.local_addr());... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_connect.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:5 | join!(server, client);
}
// Note that WASIp2 _does_ support asynchronous name lookups without
// requiring a worker thread, so this test could be ungated if/when that's
// implemented.
#[cfg_attr(
target_os = "wasi",
ignore = "net::lookup_host requires multithreading, which WASI does not yet support"
)]
#[toki... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_connect.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:6 | use std::io::Write;
use std::time::Duration;
use std::{net, thread};
#[tokio::test]
fn poll_hup() {
let addr = assert_ok!("127.0.0.1:0".parse());
let mut srv = assert_ok!(TcpListener::bind(&addr));
let addr = assert_ok!(srv.local_addr());
tokio::spawn(async move {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_connect.rs | 201 | 252 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:7 | // Read the data
future::poll_fn(|| stream.poll_read(&mut buf))
.wait()
.unwrap();
assert_eq!(b"hello world", &buf[..]);
t.join().unwrap();
}
}
*/ | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_connect.rs | 241 | 252 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No `socket` on miri.
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use futur... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | f1cb007a281d49104e7b0e29d4ba5c6e7a06af11 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1cb007a281d49104e7b0e29d4ba5c6e7a06af11/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:2 | let addr = assert_ok!(srv.local_addr());
assert!(addr.is_ipv6());
let (tx, rx) = oneshot::channel();
tokio::spawn(async move {
let (socket, addr) = assert_ok!(srv.accept().await);
assert_eq!(addr, assert_ok!(socket.peer_addr()));
assert_ok!(tx.send(socket));
});
let mine =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | f1cb007a281d49104e7b0e29d4ba5c6e7a06af11 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1cb007a281d49104e7b0e29d4ba5c6e7a06af11/tokio/tests/tcp_connect.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:3 | #[tokio::test]
async fn connect_addr_ip_str_slice() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let addr = assert_ok!(srv.local_addr());
let addr = format!("127.0.0.1:{}", addr.port());
let server = async {
assert_ok!(srv.accept().await);
};
let client = async {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | f1cb007a281d49104e7b0e29d4ba5c6e7a06af11 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1cb007a281d49104e7b0e29d4ba5c6e7a06af11/tokio/tests/tcp_connect.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:4 | let server = async {
assert_ok!(srv.accept().await);
};
let client = async {
assert_ok!(TcpStream::connect(&addr).await);
};
join!(server, client);
}
#[tokio::test]
async fn connect_addr_ip_str_port_tuple() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let ad... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | f1cb007a281d49104e7b0e29d4ba5c6e7a06af11 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1cb007a281d49104e7b0e29d4ba5c6e7a06af11/tokio/tests/tcp_connect.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:5 | assert_ok!(TcpStream::connect(&addr).await);
};
join!(server, client);
}
/*
* TODO: bring this back once TCP exposes HUP again
*
#[cfg(target_os = "linux")]
mod linux {
use tokio::net::{TcpListener, TcpStream};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio_test::assert_ok;
use mio... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | f1cb007a281d49104e7b0e29d4ba5c6e7a06af11 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1cb007a281d49104e7b0e29d4ba5c6e7a06af11/tokio/tests/tcp_connect.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:6 | client.write(b"hello world").unwrap();
thread::sleep(Duration::from_millis(200));
});
*/
let mut stream = assert_ok!(TcpStream::connect(&addr).await);
// Poll for HUP before reading.
future::poll_fn(|| stream.poll_read_ready(UnixReady::hup().into()))
.wa... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | f1cb007a281d49104e7b0e29d4ba5c6e7a06af11 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1cb007a281d49104e7b0e29d4ba5c6e7a06af11/tokio/tests/tcp_connect.rs | 201 | 230 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:5 | assert_ok!(TcpStream::connect(&addr).await);
};
join!(server, client);
}
/*
* TODO: bring this back once TCP exposes HUP again
*
#[cfg(target_os = "linux")]
mod linux {
use tokio::net::{TcpListener, TcpStream};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio_test::assert_ok;
use mio... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 3bf2e53f0b65833824e71b6a0532513004d65d4e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3bf2e53f0b65833824e71b6a0532513004d65d4e/tokio/tests/tcp_connect.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:6 | client.set_linger(Some(Duration::from_millis(0))).unwrap();
client.write(b"hello world").unwrap();
thread::sleep(Duration::from_millis(200));
});
*/
let mut stream = assert_ok!(TcpStream::connect(&addr).await);
// Poll for HUP before reading.
future::pol... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 3bf2e53f0b65833824e71b6a0532513004d65d4e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3bf2e53f0b65833824e71b6a0532513004d65d4e/tokio/tests/tcp_connect.rs | 201 | 231 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:5 | assert_ok!(TcpStream::connect(&addr).await);
};
join!(server, client);
}
/*
* TODO: bring this back once TCP exposes HUP again
*
#[cfg(target_os = "linux")]
mod linux {
use tokio::net::{TcpListener, TcpStream};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio_test::assert_ok;
use mio... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/tcp_connect.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use futures::join;
#[tokio::test]
async fn connect_v4() {
let srv = assert_ok!(TcpListener::bin... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:2 | assert!(addr.is_ipv6());
let (tx, rx) = oneshot::channel();
tokio::spawn(async move {
let (socket, addr) = assert_ok!(srv.accept().await);
assert_eq!(addr, assert_ok!(socket.peer_addr()));
assert_ok!(tx.send(socket));
});
let mine = assert_ok!(TcpStream::connect(&addr).await);... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_connect.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:3 | #[tokio::test]
async fn connect_addr_ip_str_slice() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let addr = assert_ok!(srv.local_addr());
let addr = format!("127.0.0.1:{}", addr.port());
let server = async {
assert_ok!(srv.accept().await);
};
let client = async {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_connect.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:4 | let server = async {
assert_ok!(srv.accept().await);
};
let client = async {
assert_ok!(TcpStream::connect(&addr).await);
};
join!(server, client);
}
#[tokio::test]
async fn connect_addr_ip_str_port_tuple() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let ad... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_connect.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:5 | };
join!(server, client);
}
/*
* TODO: bring this back once TCP exposes HUP again
*
#[cfg(target_os = "linux")]
mod linux {
use tokio::net::{TcpListener, TcpStream};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio_test::assert_ok;
use mio::unix::UnixReady;
use futures_util::future:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_connect.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:6 | thread::sleep(Duration::from_millis(200));
});
*/
let mut stream = assert_ok!(TcpStream::connect(&addr).await);
// Poll for HUP before reading.
future::poll_fn(|| stream.poll_read_ready(UnixReady::hup().into()))
.wait()
.unwrap();
// Same for wr... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_connect.rs | 201 | 229 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use futures::join;
#[tokio::test]
async fn connect_v4() {
let srv = assert_ok!(TcpListener::bind("127.0.0.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | e5e88551d2be7655ee71771533168d4fe9ea7793 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e5e88551d2be7655ee71771533168d4fe9ea7793/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use futures::join;
#[tokio::test]
async fn connect_v4() {
let srv = assert_ok!(TcpListener::bind("127.0.0.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use futures::join;
#[tokio::test]
async fn connect_v4() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").aw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 808d52563e234769d2fc296ff17ca12173735d9e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/808d52563e234769d2fc296ff17ca12173735d9e/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use futures::join;
#[tokio::test]
async fn connect_v4() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").aw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use futures::join;
#[tokio::test]
async fn connect_v4() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let addr = assert_ok!(srv.local_addr());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:4 | let server = async {
assert_ok!(srv.accept().await);
};
let client = async {
assert_ok!(TcpStream::connect(&addr).await);
};
join!(server, client);
}
#[tokio::test]
async fn connect_addr_ip_str_port_tuple() {
let srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let ad... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/tcp_connect.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:5 | };
join!(server, client);
}
/*
* TODO: bring this back once TCP exposes HUP again
*
#[cfg(target_os = "linux")]
mod linux {
use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::*;
use tokio_test::assert_ok;
use mio::unix::UnixReady;
use futures_util::future::poll_fn;
use std::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/tcp_connect.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
use futures::join;
#[tokio::test]
async fn connect_v4() {
let mut srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let addr = assert_ok!(srv.local_addr(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/tcp_connect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:2 | assert!(addr.is_ipv6());
let (tx, rx) = oneshot::channel();
tokio::spawn(async move {
let (socket, addr) = assert_ok!(srv.accept().await);
assert_eq!(addr, assert_ok!(socket.peer_addr()));
assert_ok!(tx.send(socket));
});
let mine = assert_ok!(TcpStream::connect(&addr).await);... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/tcp_connect.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:3 | #[tokio::test]
async fn connect_addr_ip_str_slice() {
let mut srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
let addr = assert_ok!(srv.local_addr());
let addr = format!("127.0.0.1:{}", addr.port());
let server = async {
assert_ok!(srv.accept().await);
};
let client = async {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/tcp_connect.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/tcp_connect.rs:4 | let server = async {
assert_ok!(srv.accept().await);
};
let client = async {
assert_ok!(TcpStream::connect(&addr).await);
};
join!(server, client);
}
#[tokio::test]
async fn connect_addr_ip_str_port_tuple() {
let mut srv = assert_ok!(TcpListener::bind("127.0.0.1:0").await);
le... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_connect.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/tcp_connect.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
// WASIp1 doesn't support bind
// No `socket` on miri.
#![cfg(all(
feature = "net",
feature = "macros",
feature = "rt",
feature = "io-util",
not(all(target_os = "wasi", target_env = "p1")),
not(miri)
))]
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::n... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_echo.rs | 1 | 51 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No socket on miri.
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::sy... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/tcp_echo.rs | 1 | 43 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn echo_server() {
cons... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_echo.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn echo_server() {
const ITER: usi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/tcp_echo.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn echo_server() {
const ITER: usize = 102... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/tcp_echo.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn echo_server() {
const ITER: usize = 1024;
let (tx, rx) = oneshot::channel();
let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/tcp_echo.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::*;
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn echo_server() {
const ITER: usize = 1024;
let (tx, rx) = oneshot::channel();
let srv = assert_ok!(TcpListener... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/tcp_echo.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::*;
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn echo_server() {
const ITER: usize = 1024;
let (tx, rx) = oneshot::channel();
let mut srv = assert_ok!(TcpList... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | 3ecaa6d91cef271b4c079a2e28bc3270280bcee6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ecaa6d91cef271b4c079a2e28bc3270280bcee6/tokio/tests/tcp_echo.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/tcp_echo.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::*;
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn echo_server() {
const ITER: usize = 1024;
let (tx, rx) = oneshot::channel();
let mut srv = assert_ok!(TcpList... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_echo.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/tcp_echo.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support multithreading or peeking
// No `socket` on miri.
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:2 | async {
let mut read_buf = [0u8; 32];
let peek_len1 = read_half.peek(&mut read_buf[..]).await?;
let peek_len2 = read_half.peek(&mut read_buf[..]).await?;
assert_eq!(peek_len1, peek_len2);
let read_len = read_half.read(&mut read_buf[..]).await?;
as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_into_split.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:3 | Ok(())
}
/// Test that dropping the write half actually closes the stream.
#[tokio::test]
async fn drop_write() -> Result<()> {
const MSG: &[u8] = b"split";
let listener = net::TcpListener::bind("127.0.0.1:0")?;
let addr = listener.local_addr()?;
let handle = thread::spawn(move || {
let (mut ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_into_split.rs | 81 | 132 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:4 | drop(write_half);
});
match read_half.read(&mut read_buf[..]).await {
Ok(0) => {}
Ok(len) => panic!("Unexpected read: {len} bytes."),
Err(err) => panic!("Unexpected error: {err}."),
}
handle.join().unwrap().unwrap();
Ok(())
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_into_split.rs | 121 | 132 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No `socket` on miri.
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, thread};
use tokio::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, thread};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::try... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:2 | let mut read_buf = [0u8; 32];
let peek_len1 = read_half.peek(&mut read_buf[..]).await?;
let peek_len2 = read_half.peek(&mut read_buf[..]).await?;
assert_eq!(peek_len1, peek_len2);
let read_len = read_half.read(&mut read_buf[..]).await?;
assert_eq!(peek_len1, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/tcp_into_split.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:3 | }
/// Test that dropping the write half actually closes the stream.
#[tokio::test]
async fn drop_write() -> Result<()> {
const MSG: &[u8] = b"split";
let listener = net::TcpListener::bind("127.0.0.1:0")?;
let addr = listener.local_addr()?;
let handle = thread::spawn(move || {
let (mut stream,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/tcp_into_split.rs | 81 | 131 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:4 | });
match read_half.read(&mut read_buf[..]).await {
Ok(0) => {}
Ok(len) => panic!("Unexpected read: {len} bytes."),
Err(err) => panic!("Unexpected error: {err}."),
}
handle.join().unwrap().unwrap();
Ok(())
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/tcp_into_split.rs | 121 | 131 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:2 | let mut read_buf = [0u8; 32];
let peek_len1 = read_half.peek(&mut read_buf[..]).await?;
let peek_len2 = read_half.peek(&mut read_buf[..]).await?;
assert_eq!(peek_len1, peek_len2);
let read_len = read_half.read(&mut read_buf[..]).await?;
assert_eq!(peek_len1, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_into_split.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:3 | }
/// Test that dropping the write half actually closes the stream.
#[tokio::test]
async fn drop_write() -> Result<()> {
const MSG: &[u8] = b"split";
let listener = net::TcpListener::bind("127.0.0.1:0")?;
let addr = listener.local_addr()?;
let handle = thread::spawn(move || {
let (mut stream,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_into_split.rs | 81 | 131 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:4 | });
match read_half.read(&mut read_buf[..]).await {
Ok(0) => {}
Ok(len) => panic!("Unexpected read: {} bytes.", len),
Err(err) => panic!("Unexpected error: {}.", err),
}
handle.join().unwrap().unwrap();
Ok(())
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_into_split.rs | 121 | 131 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, thread};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::try_join;
#[t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, thread};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::try_join;
#[t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:2 | let mut read_buf = vec![0u8; 32];
let peek_len1 = read_half.peek(&mut read_buf[..]).await?;
let peek_len2 = read_half.peek(&mut read_buf[..]).await?;
assert_eq!(peek_len1, peek_len2);
let read_len = read_half.read(&mut read_buf[..]).await?;
assert_eq!(peek_le... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/tcp_into_split.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, thread};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::try_join;
#[tokio::te... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, thread};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::try_join;
#[tokio::test]
async fn split() -> Result<()> {
const MSG:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:3 | }
/// Test that dropping the write half actually closes the stream.
#[tokio::test]
async fn drop_write() -> Result<()> {
const MSG: &[u8] = b"split";
let listener = net::TcpListener::bind("127.0.0.1:0")?;
let addr = listener.local_addr()?;
let handle = thread::spawn(move || {
let (mut stream,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/tcp_into_split.rs | 81 | 131 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, thread};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::try_join;
#[tokio::test]
async fn split() -> Result<()> {
const MSG:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 98e78314794607d0b402d5e45c66e3b8e38b819c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98e78314794607d0b402d5e45c66e3b8e38b819c/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::sync::{Arc, Barrier};
use std::{net, thread};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::try_join;
#[tokio::test]
async fn split()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | db0d6d75b3b65812837c8561269e55eab00a74dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/db0d6d75b3b65812837c8561269e55eab00a74dd/tokio/tests/tcp_into_split.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:2 | async {
let mut read_buf = vec![0u8; 32];
let peek_len1 = read_half.peek(&mut read_buf[..]).await?;
let peek_len2 = read_half.peek(&mut read_buf[..]).await?;
assert_eq!(peek_len1, peek_len2);
let read_len = read_half.read(&mut read_buf[..]).await?;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | db0d6d75b3b65812837c8561269e55eab00a74dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/db0d6d75b3b65812837c8561269e55eab00a74dd/tokio/tests/tcp_into_split.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:3 | Ok(())
}
/// Test that dropping the write half actually closes the stream.
#[tokio::test]
async fn drop_write() -> Result<()> {
const MSG: &[u8] = b"split";
let listener = net::TcpListener::bind("127.0.0.1:0")?;
let addr = listener.local_addr()?;
let barrier = Arc::new(Barrier::new(2));
let barri... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | db0d6d75b3b65812837c8561269e55eab00a74dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/db0d6d75b3b65812837c8561269e55eab00a74dd/tokio/tests/tcp_into_split.rs | 81 | 139 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:4 | assert_eq!(&read_buf[..read_len], MSG);
// drop it while the read is in progress
std::thread::spawn(move || {
thread::sleep(std::time::Duration::from_millis(50));
drop(write_half);
});
match read_half.read(&mut read_buf[..]).await {
Ok(0) => {}
Ok(len) => panic!("Unexpe... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | db0d6d75b3b65812837c8561269e55eab00a74dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/db0d6d75b3b65812837c8561269e55eab00a74dd/tokio/tests/tcp_into_split.rs | 121 | 139 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:2 | async {
let mut read_buf = vec![0u8; 32];
let peek_len1 = read_half.peek(&mut read_buf[..]).await?;
let peek_len2 = read_half.peek(&mut read_buf[..]).await?;
assert_eq!(peek_len1, peek_len2);
let read_len = read_half.read(&mut read_buf[..]).await?;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 8f3a26597270871a2adbf4f8da80a82961e9e296 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f3a26597270871a2adbf4f8da80a82961e9e296/tokio/tests/tcp_into_split.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/tcp_into_split.rs:3 | Ok(())
}
/// Test that dropping the write half actually closes the stream.
#[tokio::test]
async fn drop_write() -> Result<()> {
const MSG: &[u8] = b"split";
let listener = net::TcpListener::bind("127.0.0.1:0")?;
let addr = listener.local_addr()?;
let barrier = Arc::new(Barrier::new(2));
let barri... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_split.rs | MIT | 8f3a26597270871a2adbf4f8da80a82961e9e296 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8f3a26597270871a2adbf4f8da80a82961e9e296/tokio/tests/tcp_into_split.rs | 81 | 139 |
tokio-rs/tokio:tokio/tests/tcp_into_std.rs:1 | #![warn(rust_2018_idioms)]
// WASIp1 doesn't support bind
// No `socket` on miri.
#![cfg(all(
feature = "net",
feature = "macros",
feature = "rt",
feature = "io-util",
not(all(target_os = "wasi", target_env = "p1")),
not(miri)
))]
use std::io::Read;
use std::io::Result;
use tokio::io::{AsyncRea... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_std.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_into_std.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/tcp_into_std.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No socket on `miri`.
use std::io::Read;
use std::io::Result;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::Tcp... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_std.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/tcp_into_std.rs | 1 | 46 |
tokio-rs/tokio:tokio/tests/tcp_into_std.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
use std::io::Read;
use std::io::Result;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
use tokio::net::TcpStream;
#[tokio::test]
async fn tcp_into_std() -> Result<()> ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_std.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/tcp_into_std.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/tcp_into_std.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind
use std::io::Read;
use std::io::Result;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
use tokio::net::TcpStream;
#[tokio::test]
async fn tcp_into_std() -> Result<()> {
let m... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_std.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/tcp_into_std.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/tcp_into_std.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind
use std::io::Read;
use std::io::Result;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
use tokio::net::TcpStream;
#[tokio::test]
async fn tcp_into_std() -> Result<()> {
let mut data ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/tcp_into_std.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/tcp_into_std.rs | 1 | 45 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.