-
Notifications
You must be signed in to change notification settings - Fork 18
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
session fails to decode correct mpack rpc string #17
Comments
That's the expected behavior: https://github.com/libmpack/libmpack-lua/blob/master/lmpack.c#L913-L916 |
Let me elaborate a little bit: Technically we could allow the session to be recovered by resetting the session struct to its initial values, but the only sane thing to do is discard the connection. Think of it as a failed assertion, if at a certain point in the stream we receive an invalid byte, it is pretty reasonable to imagine that the other side of the connection has a broken implementation of the protocol, so there's no reason to assume that all the bytes following the invalid one will be valid. |
Ok. Thx for the fast reply! I am not well versed enough in the inner workings of the lua C api to figure out what exactly is going on. I wanted to use the session:receive as a check to distinguish between normal msgpack messages and RPC's. Creating an extra check function seems to be the only workaround. |
Yes, the "message type" field is not reset when there's an error. We could eventually add a "reset" method that allows reusing the session after a failed parse, but for now the workaround is to create a new session |
It seems the session:receive fails continuously to decode a correct msgpack rpc string once it first correctly fails on non rpc mpack data.
I can't seem to find a way to fix it except for creating a new session.
Here's a small script to demonstrate.
The text was updated successfully, but these errors were encountered: