dignifiedquire / pull-length-prefixed

Streaming length prefixed buffers with pull-streams
MIT License
8 stars 18 forks source link

Zero-length streams #20

Closed robertkiel closed 5 years ago

robertkiel commented 5 years ago

The current implementation leads to exceptions when it is used to encode zero-length streams. To ensure that, I'd suggest the following enhancements:

Purpose of the enhancements: When using the library in combination with libp2p, it happens once in a while that some nodes answer with empty messages that leads to an exception at the receiver when using length-prefixed pull-streams. In general, empty messages doesn't make any sense. But when using it in a p2p context, they're useful to tell other nodes that they cannot help with that issue and have therefore no answer.

Thanks in advance ;-) Robert

dignifiedquire commented 5 years ago

thank you, fixed in #22