-
Notifications
You must be signed in to change notification settings - Fork 385
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
Add a special ProtobufError for truncated message #154
Comments
Protobuf messages are not self-delimited. Protobuf reads messages until EOF (or until explicitly specified limit). When transferring messages over network, messages are usually prepended with length (with function like
|
Right, and that's what I'm doing, but it's pretty awkward to manually read the length like that. I'm doing that on the client side of my app currently, since It seems like at the very least the |
Related: #157 (the other issue I mentioned) |
Closing due to old age. |
update build.rs example in README
I'm using rust-protobuf to send and receive protobuf messages over sockets. The server is using mio, and it tries to parse the message with whatever bytes it has received so far by using
parse_length_delimited_from_bytes
. Unfortunately, if the entire message hasn't been received yet, the only way to tell is to check that the returned error is aProtobufError::WireError("truncated message")
:https://github.com/luser/sccache2/blob/1ad02689a9829502cd09b2b7381cec431a01e5a7/src/server.rs#L332
If would be nice if there was a separate
ProtobufError::MessageTruncated
so that I didn't have to do string comparison to catch this fairly likely case.Maybe I'm missing something, if so I'd appreciate any info.
The text was updated successfully, but these errors were encountered: