For some reaosn, any difference between exact bytes written and read (even if they are identical, just spread over different `write` calls) causes the reading half to produce garbage?
For ESock to work, a `write(n)` needs to be paired with a `read(n)` for identical sizes of `n`. Not using `write_all(n)`+`read_exact(n)` causes this disjoint too? (Test with `write_all(n)`+`while read(...)` produced garbage.)
I have no idea what is going on here. I think there"s some disconnect with the cipher, but it"s a stream cipher, so positioning (i.e. where byte pattern `A` appears in slice `B` on the writing side, and slice `C` on the reading size) shouldn"t matter right? Clearly it seems to.
This is extremely disappointing.
Fortune for rsh's current commit: Future small blessing − 末小吉
//XXXXXXX: This isn't working. The first write to the socket succeeds. Any subsequent writes/reads produce garbage. Why?
//XXX: For some reason, non-exact reads + writes cause garbage to be produced on the receiving end?
// Is this fixable? Why does it disjoint? I have no idea... This is supposed to be a stream cipher, right? Why does positioning matter? Have I misunderstood how it workd? Eh...
impl<W,R>AsyncWriteforESock<W,R>
impl<W,R>AsyncWriteforESock<W,R>
whereW: AsyncWrite
whereW: AsyncWrite
@ -717,7 +718,7 @@ mod tests
// The duplex buffer size here is smaller than an RSA ciphertext block. So, writing the session key must be buffered with a buffer size this small (should return Pending at least once.)
// The duplex buffer size here is smaller than an RSA ciphertext block. So, writing the session key must be buffered with a buffer size this small (should return Pending at least once.)
// Using a low buffer size to make sure the test passes even when the entire buffer cannot be written at once.
// Using a low buffer size to make sure the test passes even when the entire buffer cannot be written at once.
let(muttx,mutrx)=gen_duplex_esock(256).wrap_err(eyre!("Failed to weave socks"))?;
let(muttx,mutrx)=gen_duplex_esock(16).wrap_err(eyre!("Failed to weave socks"))?;