Skip to content

Commit

Permalink
Write handling improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Sep 5, 2024
1 parent 4a498b0 commit 463a236
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: RUST_LOG=trace cargo +nightly llvm-cov --no-report --all --doctests --no-default-features --features="tokio,cookie,url,compress,openssl,rustls,ws,brotli"

- name: Generate coverage report
run: cargo +nightly llvm-cov report --lcov --output-path lcov.info --ignore-filename-regex="ntex-tokio|ntex-glommio|ntex-async-std"
run: cargo +nightly llvm-cov report --lcov --output-path lcov.info --ignore-filename-regex="ntex-tokio|ntex-glommio|ntex-async-std|ntex-compio"

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
24 changes: 13 additions & 11 deletions ntex-compio/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,23 @@ async fn write<T: AsyncWrite>(io: &mut T, state: &WriteContext) -> io::Result<()
let BufResult(result, buf1) = io.write(buf).await;
buf = buf1;

match result {
return match result {
Ok(0) => Err(io::Error::new(
io::ErrorKind::WriteZero,
"failed to write frame to transport",
)),
Ok(size) => {
if buf.0.len() == size {
return io.flush().await;
// return io.flush().await;
state.memory_pool().release_write_buf(buf.0);
Ok(())
} else {
buf.0.advance(size);
continue;
}
if size == 0 {
return Err(io::Error::new(
io::ErrorKind::WriteZero,
"failed to write frame to transport",
));
}
buf.0.advance(size);
}
Err(e) => return Err(e),
}
Err(e) => Err(e),
};
}
})
.await
Expand Down

0 comments on commit 463a236

Please sign in to comment.