Closed Fotosmile closed 4 years ago
Hi. The case that I use is reading from TcpStream, so I do not know in advance the size of a buffer, which I need. In my case, I reserve 1024 buffer block, pass the block to TcpStream::read, truncate the block by the read size and send the reserved block to write. If I do not truncate the buffer, a receiver will read the data with zeros at the end :( Thanks!
That makes sense! Thanks for clarifying. I need to convince myself that this doesn’t break the sender/receiver coordination, which I don’t think it does but I want to take a closer look tomorrow.
(sent from mobile)
On 18 Dec 2019, at 18:22, Vladyslav Hordiienko notifications@github.com wrote:
Hi. The case that I use is reading from TcpStream, so I do not know in advance the size of a buffer, which I need. In my case, I reserve 1024 buffer block, pass the block to TcpStream::read, truncate the block by the read size and send the reserved block to write. If I do not truncate the buffer, a receiver will read the data with zeros at the end :( Thanks!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Could you please rebase and remove the cargo fmt commit? I understand it has benefits in some projects, but I’m not a huge fan of some of the formatting changes it makes, and I believe it unnecessarily pollutes git history.
Could you please rebase and remove the cargo fmt commit? I understand it has benefits in some projects, but I’m not a huge fan of some of the formatting changes it makes, and I believe it unnecessarily pollutes git history.
Yeah, of course. Done.
Sorry this took a bit longer than originally promised! I’m going to expand a bit on the docstring after I merge, but looks good otherwise. Thank you!
What are your thought on something like https://github.com/utaal/spsc-bip-buffer/pull/7 ?
Hi! Thanks for the PR! Can you explain a bit more what's your use case for this? There's a performance implication of attempting to reserve a segment that's longer than you really need (as you may need to wait for it to free up), so I'd like to think through why we need this. Thanks!