tokio-rs / tokio-uring

An io_uring backed runtime for Rust
MIT License
1.14k stars 122 forks source link

Add support for zerocopy write to the TCP socket #237

Open redbaron opened 1 year ago

redbaron commented 1 year ago

Intorduce zero copy version of TcpStream::write using write_zc name.

It behaves almost the same, except returned future will be complete when remotes side ACKs receipt of the buffer content, unlike TcpStream::write which completes when data copied into local TCP socket kernel buffers.

redbaron commented 1 year ago

hm, cargo test --doc completes on my kernel 6.1.9 system:

test result: ok. 65 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 11.17s

and cargo test fails on fallocate only, which is unchanged in this PR:

---- basic_fallocate stdout ----
thread 'basic_fallocate' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 95, kind: Uncategorized, message: "Operation not supported" }', tests/fs_file.rs:295:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    basic_fallocate

test result: FAILED. 14 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
FrankReh commented 1 year ago

I believe it unusual not to provide a high level description of what is going on with the PR. That's what the top description is for. A reviewer, or anyone else, should not have to read through the code diffs to figure out the intent and the way the intent is being handled. If you read through the git log for this repo, you will see the level of detail that is usually given.

And unless you are absolutely sure of yourself. It is safer to create an Issue first talking about what you think is missing and what you would propose doing about it.

FrankReh commented 1 year ago

And if you do create a PR but you didn't think it was ready for review and submission, please make it a draft.