mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-06 22:37:39 +03:00
Optimize io read task
This commit is contained in:
parent
f2cd676ac3
commit
2a19b7f995
4 changed files with 19 additions and 15 deletions
|
@ -50,9 +50,9 @@ impl Future for ReadTask {
|
|||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
let this = self.as_ref();
|
||||
|
||||
this.state.with_buf(|buf, hw, lw| {
|
||||
match ready!(this.state.poll_ready(cx)) {
|
||||
ReadStatus::Ready => {
|
||||
match ready!(this.state.poll_ready(cx)) {
|
||||
ReadStatus::Ready => {
|
||||
this.state.with_buf(|buf, hw, lw| {
|
||||
// read data from socket
|
||||
let mut io = self.io.borrow_mut();
|
||||
loop {
|
||||
|
@ -80,13 +80,13 @@ impl Future for ReadTask {
|
|||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
ReadStatus::Terminate => {
|
||||
log::trace!("read task is instructed to shutdown");
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
ReadStatus::Terminate => {
|
||||
log::trace!("read task is instructed to shutdown");
|
||||
Poll::Ready(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue