-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: eof
error handling when decoding in CborCodec
#7
Conversation
eof
error handling when decoding in CborCodec
eof
error handling when decoding in CborCodec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, thank you for the work here. I have one more suggestion. Otherwise this is good to go.
Related, the other Codec
implementations in this crate face the same issue. In case you are interested, I would very much appreciate fixes for those as well. No worries if not.
asynchronous-codec/src/codec/json.rs
Lines 117 to 131 in 43338f6
// Attempt to fetch an item and generate response | |
let res = match iter.next() { | |
Some(Ok(v)) => Ok(Some(v)), | |
Some(Err(ref e)) if e.is_eof() => Ok(None), | |
Some(Err(e)) => Err(e.into()), | |
None => Ok(None), | |
}; | |
// Update offset from iterator | |
let offset = iter.byte_offset(); | |
// Advance buffer | |
buf.advance(offset); | |
res |
Co-authored-by: Max Inden <[email protected]>
Happy to add this too 👍 |
@mxinden thanks for your feedback, think this is ready to go now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, well done. Thank you.
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
and this project adheres to [Semantic | |||
Versioning](https://semver.org/spec/v2.0.0.html). | |||
|
|||
## [0.6.2] - unreleased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## [0.6.2] - unreleased | |
## [0.6.2] |
|
||
### Fixed | ||
|
||
- Error handling in `CborCodec` and `JsonCodec` `decode` [#7](https://github.com/mxinden/asynchronous-codec/pull/7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Error handling in `CborCodec` and `JsonCodec` `decode` [#7](https://github.com/mxinden/asynchronous-codec/pull/7) | |
- Error handling in `CborCodec` and `JsonCodec` `decode`, more specifically not advancing the data buffer on partial decoding. See [#7](https://github.com/mxinden/asynchronous-codec/pull/7) for details. |
I was not able to accept the above suggestions, thus merged through #8. Attribution should still be tracked for your work. |
Closes: #6
return
when decoding iseof
and don't advance the bufferCHANGLOG