[zeromq-dev] zmq_proxy_steerable
Brian Knox
taotetek at gmail.com
Sun Dec 1 19:11:07 CET 2013
So - for fun I patched my local libzmq and changed the length check to not
take the null terminator into account...
if (msg.size () == 5 && memcmp (msg.data (), "PAUSE", 5) == 0)
...and now I can send the PAUSE command using zstr_send - so this confirms
my thought.
Since the least disruptive change now that I understand what's going on is
just to change my zproxy code to send the full char with terminator using
zmsg rather than zstr, I'll do that - just following up to my question in
case this information is useful to others.
Brian
On Sun, Dec 1, 2013 at 10:39 AM, Brian Knox <taotetek at gmail.com> wrote:
> Hello!
>
> I'm working on adding support for zmq_proxy_steerable commands to zproxy
> in czmq. I noticed I was getting an invalid proxy command error when
> trying to send a "PAUSE" command using zstr_send.
>
> Taking a look at the libzmq proxy.cpp code ~ line 117 on libzmq head (
> https://github.com/zeromq/libzmq/blob/master/src/proxy.cpp#L117) , I see:
>
> --------------------------------------------------
> if (msg.size () == 6 && memcmp (msg.data (), "PAUSE", 6) == 0)
> state = paused;
> ----------------------------------------------------
>
> My understanding is that zstr_send (from czmq) does not send the NULL at
> the end of the string, and zstr_recv adds one (
> https://github.com/zeromq/czmq/blob/master/src/zstr.c#L68 )
>
> While I know libzmq is not czmq - I just want to make sure I understand
> the libzmq code. Should I be sending "PAUSE" with a null terminator, and
> is that why the command check in proxy.cpp is looking for a message size of
> 6 rather than 5?
>
> Thanks!
> Brian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131201/b3fb6806/attachment.htm>
More information about the zeromq-dev
mailing list