[zeromq-dev] zmq_proxy_steerable

Pieter Hintjens ph at imatix.com
Mon Dec 2 16:04:19 CET 2013


Yes, the full version number allows for two digits for major, minor,
and patches. So NN-NN-NN is the structure. It's not obvious, and I
find myself dropping a zero by mistake sometimes.

-Pieter

On Mon, Dec 2, 2013 at 4:00 PM, Brian Knox <briank at talksum.com> wrote:
> Tested it - 40100 is indeed correct against my current libzmq head.  Sorry for the noise, hopefully my rambling was useful for someone else!
>
> Brian
> ________________________________________
> From: zeromq-dev-bounces at lists.zeromq.org <zeromq-dev-bounces at lists.zeromq.org> on behalf of Brian Knox <briank at talksum.com>
> Sent: Monday, December 02, 2013 9:27 AM
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] zmq_proxy_steerable
>
> I now have terminate, pause and resume working in my fork of czmq.  The last piece I need to do is wrap some portions in #if (ZMQ_VERSION >= foo) calls to make sure I don't break backwards compatibility with previous libzmq versions.
>
> I'm a little fuzzy on the ZMQ_VERSION / MAKE_ZMQ_VERSION macros ... would the proper ZMQ_VERSION for ZMQ_VERSION_MAJOR 4, ZMQ_VERSION_MINOR 1, ZMQ_VERSION_PATCH 0 be "40100"?  eg...
>
> #if (ZMQ_VERSION >= 40100)
> ...
> #else
> ...
>
> Thanks,
> Brian
> ________________________________________
> From: zeromq-dev-bounces at lists.zeromq.org <zeromq-dev-bounces at lists.zeromq.org> on behalf of Pieter Hintjens <ph at imatix.com>
> Sent: Sunday, December 01, 2013 2:47 PM
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] zmq_proxy_steerable
>
> The usual convention (it's described in the Guide pretty early on) is
> to not send or assume trailing null characters.  zstr_send/recv remove
> and add the null characters explicitly. Expecting a null in the raw
> message data is wrong... and your fix is correct.
>
> On Sun, Dec 1, 2013 at 7:11 PM, Brian Knox <taotetek at gmail.com> wrote:
>> 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
>>
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev



More information about the zeromq-dev mailing list