-
Notifications
You must be signed in to change notification settings - Fork 484
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
Curve encryption does not encode or decode "command" flag #696
Comments
Oops, that was forgotten. Thanks for catching that! Libzmq seems to agree with you: https://github.com/zeromq/libzmq/blob/master/src/curve_mechanism_base.cpp#L63 Could you make a PR for that? |
I was looking into this issue I just noticed that JeroMQ isn't following spec... e.g. The commands aren't prefixed with the size of the command. I don't see how this would work cross implementations. |
I'm not sure what to make of that. I see the difference you're pointing out, but I can confirm that with the command flag added as per the commit above, my jeromq endpoint was able to successfully respond to heartbeat pings from an endpoint using libzmq. |
The commands are prefixed by the length. It's done in Msgs class. |
The |
Everyone is free to propose a PR! |
Solution: create a new method in Msg to allow put short string prefixed with length. Fixes zeromq#696
Solution: create a new method in Msg to allow put short string prefixed with length. Fixes zeromq#696
I am working on a project using jeromq v0.5.0 as the REQ side of a REQ-REP communication. The symptom is that the connection heartbeating added in v0.5.0 works when Curve is disabled, but not when it is enabled.
This seems to be related to flags: in zmq.io.mechanism.curve.CurveServerMechanism and CurveClientMechanism, there are encode and decode methods called by zmq.io.StreamEngine. These four methods set or read the 0x1/MORE flag but no others. This means that ping/pong messages, which use the 0x2/COMMAND flag, don't read or set that flag and the message gets treated as data instead.
Between two Java endpoints, the flag is never set in the data that goes over the socket. Between Java and C, it depends on the message source: when the Java side is the source, the command flag is not set when sending so the receiver raises an alarm and drops the message. When the C side is the source, the flag is present in the encoded message as received but not passed onto the decoded message, so the StreamEngine doesn't recognize it as a command and drops the message.
I was able to get it working between two Java endpoints, as well as between Java and C, by adding code to those four methods to read or set the 0x2/COMMAND flag similarly to the 0x1/MORE flag that's already there. I'm not familiar enough with the other flags to know if this is the right way to address the issue or if there's more to it, but it does get heartbeats working.
The text was updated successfully, but these errors were encountered: