iroh icon indicating copy to clipboard operation
iroh copied to clipboard

API sharp edge: reading the entire stream

Open flub opened this issue 9 months ago • 0 comments

QUIC has a limit on the maximum number of open streams at any one time. However it seems it might sometimes be a bit easy to accidentally leave a stream open.

The problem is that if you know the exact size of the message on the stream, e.g. due to a length-prefixed message, you might read exactly this many bytes. But you need to read "past" the end of the stream to have consumed the whole stream. So reading the exact number of bytes might still leave you with an open stream.

I think this has affected multiple people independently, so it would be good to:

  1. Reproduce this so we are absolutely clear about the semantics.
  2. Figure out if we can improve the API to make this less brittle.

flub avatar Mar 10 '25 10:03 flub