fortanix / rust-sgx

The Fortanix Rust Enclave Development Platform
https://edp.fortanix.com
Mozilla Public License 2.0
421 stars 99 forks source link

Discrepancy in Handling Large Data Writes: tokio::net::TcpStream vs std::net::TcpStream` #615

Open yingjun-wu opened 3 weeks ago

yingjun-wu commented 3 weeks ago

When I use tokio::net::tcpstream and std::net::tcpstream to build communication with the runner in the enclave, I find that when the length of the transmitted data exceeds 16384, the tokio::net::tcpstreammethod will divide the write into several times, while the std::net::tcpstream method will not. Why is this?

Is there any way to change this method, because when splitting multiple transmissions, the overall delay will be much larger than one transmission time?

https://github.com/fortanix/rust-sgx/blob/b6f0262614ce1574b7d66226b68d7247b822d860/intel-sgx/enclave-runner/src/usercalls/interface.rs#L73-L77

I mainly understand the size of len through theL77 line of code.

Thank You!!