Skip to content

Commit

Permalink
Added print statements to trace execution
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Zak <richard@profian.com>
  • Loading branch information
rjzak committed May 25, 2022
1 parent 2d90ef5 commit c523ef9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tokio/src/io/driver/registration.rs
Expand Up @@ -247,12 +247,14 @@ cfg_io_readiness! {
}

pub(crate) async fn async_io<R>(&self, interest: Interest, mut f: impl FnMut() -> io::Result<R>) -> io::Result<R> {
println!("Tokio Registration::async_io() {}:{}", file!(), line!());
loop {
let event = self.readiness(interest).await?;

println!("Tokio Registration::async_io() self.readiness({:?}) = {:?} returned @ {}:{}", interest, event, file!(), line!());
match f() {
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
self.clear_readiness(event);
println!("Tokio Registration::async_io() self.clear_readiness() {}:{}", file!(), line!());
}
x => return x,
}
Expand Down
4 changes: 3 additions & 1 deletion tokio/src/net/tcp/listener.rs
Expand Up @@ -158,13 +158,15 @@ impl TcpListener {
/// }
/// ```
pub async fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
println!("Tokio TcpListener::accept() {}:{}", file!(), line!());
let (mio, addr) = self
.io
.registration()
.async_io(Interest::READABLE, || self.io.accept())
.await?;

println!("Tokio TcpListener::accept() self.io.registration().async_io().await {}:{}", file!(), line!());
let stream = TcpStream::new(mio)?;
println!("Tokio TcpListener::accept() TcpStream::new() {}:{}", file!(), line!());
Ok((stream, addr))
}

Expand Down

0 comments on commit c523ef9

Please sign in to comment.