Skip to content

Commit

Permalink
Dont wait for dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Sep 2, 2024
1 parent 11c01a5 commit 4a498b0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions ntex-io/src/tasks.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{future::poll_fn, future::Future, io, task::Context, task::Poll};

use ntex_bytes::{BufMut, BytesVec, PoolRef};
use ntex_util::task;

use crate::{Flags, IoRef, ReadStatus, WriteStatus};

Expand Down Expand Up @@ -157,11 +156,11 @@ impl ReadContext {
{
let inner = &self.0 .0;

// we already pushed new data to read buffer,
// we have to wait for dispatcher to read data from buffer
if inner.flags.get().is_read_buf_ready() {
task::yield_to().await;
}
// // we already pushed new data to read buffer,
// // we have to wait for dispatcher to read data from buffer
// if inner.flags.get().is_read_buf_ready() {
// ntex_util::task::yield_to().await;
// }

let mut buf = if inner.flags.get().is_read_buf_ready() {
// read buffer is still not read by dispatcher
Expand All @@ -175,9 +174,9 @@ impl ReadContext {
};

// make sure we've got room
let remaining = buf.remaining_mut();
let (hw, lw) = self.0.memory_pool().read_params().unpack();
if remaining < lw {
let remaining = buf.remaining_mut();
if remaining <= lw {

Check warning on line 179 in ntex-io/src/tasks.rs

View check run for this annotation

Codecov / codecov/patch

ntex-io/src/tasks.rs#L178-L179

Added lines #L178 - L179 were not covered by tests
buf.reserve(hw - remaining);
}
let total = buf.len();
Expand Down

0 comments on commit 4a498b0

Please sign in to comment.