mreiferson / go-snappystream

a Go package for framed snappy streams
MIT License
45 stars 13 forks source link

Reader returns an error if the first block is not streamID #12

Closed bmatsuo closed 10 years ago

bmatsuo commented 10 years ago

Also fixed various fmt bugs in the tests. (edit: i really need to inject go vet into my workflow, i added a lot of those things :frowning:)

Fixes #8.

bmatsuo commented 10 years ago

In the current state of the pull request the Reader just returns an error and forgets it ever happened. That is, subsequent calls to read will attempt to read the next block.

This behavior doesn't really seem right to me. But really it seems like any error in the reader (or writer) should cause all subsequent reads (or writes) to fail. I didn't want to go through and make that sweeping, behavior altering change right away, so I just made things consistent. What do you think @mreiferson?

mreiferson commented 10 years ago

This looks good, thanks.

I'm fine with changing the behavior now, since as implemented it's technically wrong.

bmatsuo commented 10 years ago

Sorry for the delay. It was a busy week.

I modified the Reader and Writer types to avoid further i/o after an error occurs.

bmatsuo commented 10 years ago

@mreiferson ping. are you around to take a look at this?

mreiferson commented 10 years ago

ahhh, totally forgot about this, sorry!

LGTM

mreiferson commented 10 years ago

thanks @bmatsuo

bmatsuo commented 10 years ago

Thanks @mreiferson! Now I can fix that last bug :smile: