-
Notifications
You must be signed in to change notification settings - Fork 20
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
Handle partially available data #24
Comments
This needs to be efficient, meaning we don't want to "lose" progress just because we are missing some data. This means we might want to go "continuation-style" (asynchronous |
hmm, seems I do need this for classic. |
What does that mean for readers that themselves call the read method (say containers for example) ? Do they need |
Instead of a buffer, they'll be passed a stream probably? On Mon, Nov 23, 2015, 2:10 PM Romain Beaumont notifications@github.com
|
Ah yeah that makes sense. |
Hmm actually that thing on npm seems pretty old, we might need to depend on https://github.com/whatwg/streams/tree/master/reference-implementation |
Worse case scenario we can just depend on anything that exposes a similar On Mon, Nov 23, 2015, 2:32 PM Romain Beaumont notifications@github.com
|
Yeah but whatwg streams do seem reasonable, I'll try and see if they can be used. |
https://www.npmjs.com/package/pull-stream might be interesting |
These libs don't seem quite ready to be used (pull-stream works with callback and whatwg stream is unpublished). edit: maybe https://github.com/h13i32maru/eo.whatwg-streams |
@roblabla what would that means for write/sizeOf ? no change to their API ? |
I'm starting to think it might be more efficient to keep the current sync model and just return null... (and retry to parse the packet when we got more data) |
I might try again to make that promise thingy to work with nmp. Maybe I will make an alternative PR with the "throw an error" option though. It sure is a little bit less efficient if lot of packets are cut, but in the general case it's actually very likely more efficient (no async overhead !) and it keeps the API sync which is nice. |
closing this |
We used to return null in readers because the data might be partially available in <=1.6 minecraft version.
If we want to be able to handle these kind of behavior, we might want to throw a special exception in this kind of case, and then handle it properly in the parser. (I guess "wait" for more data and try again)
The text was updated successfully, but these errors were encountered: