mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
commit
cf74a6b2c9
@ -36,7 +36,7 @@ fn main() {
|
|||||||
|
|
||||||
let mut l = Core::new().unwrap();
|
let mut l = Core::new().unwrap();
|
||||||
let socket = TcpListener::bind(&addr, &l.handle()).unwrap();
|
let socket = TcpListener::bind(&addr, &l.handle()).unwrap();
|
||||||
println!("Listenering on: {}", addr);
|
println!("Listening on: {}", addr);
|
||||||
let server = socket.incoming().and_then(|(socket, addr)| {
|
let server = socket.incoming().and_then(|(socket, addr)| {
|
||||||
println!("got a socket: {}", addr);
|
println!("got a socket: {}", addr);
|
||||||
write(socket).or_else(|_| Ok(()))
|
write(socket).or_else(|_| Ok(()))
|
||||||
|
@ -64,7 +64,7 @@ pub use self::write_all::{write_all, WriteAll};
|
|||||||
/// Additionally, they're associated with the ability to test whether they're
|
/// Additionally, they're associated with the ability to test whether they're
|
||||||
/// readable or writable.
|
/// readable or writable.
|
||||||
///
|
///
|
||||||
/// Importantly, the methods of this trait are intended to be used in conjuction
|
/// Importantly, the methods of this trait are intended to be used in conjunction
|
||||||
/// with the current task of a future. Namely whenever any of them return a
|
/// with the current task of a future. Namely whenever any of them return a
|
||||||
/// value that indicates "would block" the current future's task is arranged to
|
/// value that indicates "would block" the current future's task is arranged to
|
||||||
/// receive a notification when the method would otherwise not indicate that it
|
/// receive a notification when the method would otherwise not indicate that it
|
||||||
@ -153,7 +153,7 @@ pub trait Io: io::Read + io::Write {
|
|||||||
/// Most implementations of `FramedIo` are for doing protocol level
|
/// Most implementations of `FramedIo` are for doing protocol level
|
||||||
/// serialization and deserialization.
|
/// serialization and deserialization.
|
||||||
///
|
///
|
||||||
/// Importantly, the methods of this trait are intended to be used in conjuction
|
/// Importantly, the methods of this trait are intended to be used in conjunction
|
||||||
/// with the current task of a future. Namely whenever any of them return a
|
/// with the current task of a future. Namely whenever any of them return a
|
||||||
/// value that indicates "would block" the current future's task is arranged to
|
/// value that indicates "would block" the current future's task is arranged to
|
||||||
/// receive a notification when the method would otherwise not indicate that it
|
/// receive a notification when the method would otherwise not indicate that it
|
||||||
|
@ -158,7 +158,7 @@ mod test {
|
|||||||
|
|
||||||
/// TODO: this test actually should be successful, but since we can't
|
/// TODO: this test actually should be successful, but since we can't
|
||||||
/// multiply Duration on anything larger than u32 easily we decided
|
/// multiply Duration on anything larger than u32 easily we decided
|
||||||
/// to allow thit to fail for now
|
/// to allow it to fail for now
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "can't skip more than 4 billion intervals")]
|
#[should_panic(expected = "can't skip more than 4 billion intervals")]
|
||||||
fn large_skip() {
|
fn large_skip() {
|
||||||
|
@ -154,7 +154,7 @@ impl<E> PollEvented<E> {
|
|||||||
/// then again writable.
|
/// then again writable.
|
||||||
///
|
///
|
||||||
/// Note that it is also only valid to call this method if `poll_write`
|
/// Note that it is also only valid to call this method if `poll_write`
|
||||||
/// previously indicated that the object is writeable. That is, this function
|
/// previously indicated that the object is writable. That is, this function
|
||||||
/// must always be paired with calls to `poll_write` previously.
|
/// must always be paired with calls to `poll_write` previously.
|
||||||
pub fn need_write(&self) {
|
pub fn need_write(&self) {
|
||||||
self.readiness.fetch_and(!2, Ordering::SeqCst);
|
self.readiness.fetch_and(!2, Ordering::SeqCst);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user