[zeromq-dev] Assertion failure in pull.cpp

Martin Sustrik sustrik at 250bpm.com
Tue Aug 24 14:35:53 CEST 2010


Pieter,

Thanks for the patch.

However, testing the conformity on case-by-case basis is not an ideal 
solution. What's needed is to funnel all the "attach_pipe"s -- both the 
method an the async command ("process_attach") -- via the same function 
that would test whether the pipes supplied match the requested pattern 
(requires_in and requires_out in the options structure).

Martin

On 08/21/2010 08:02 PM, Pieter Hintjens wrote:
> Martin,
>
> Please find attached a patch for issue 50.  This does not solve the
> issue but at least prints an explanatory message.
>
> -Pieter
>
>
> diff --git a/src/pull.cpp b/src/pull.cpp
> index b2413ee..1d36508 100644
> --- a/src/pull.cpp
> +++ b/src/pull.cpp
> @@ -36,6 +36,8 @@ zmq::pull_t::~pull_t ()
>   void zmq::pull_t::xattach_pipes (class reader_t *inpipe_,
>       class writer_t *outpipe_, const blob_t&peer_identity_)
>   {
> +    if (!inpipe_ || outpipe_)
> +        printf ("E: you connected PULL to PULL, please fix your code\n");
>       zmq_assert (inpipe_&&  !outpipe_);
>       fq.attach (inpipe_);
>   }
> diff --git a/src/sub.cpp b/src/sub.cpp
> index eeb50cd..5d0625d 100644
> --- a/src/sub.cpp
> +++ b/src/sub.cpp
> @@ -42,6 +42,8 @@ zmq::sub_t::~sub_t ()
>   void zmq::sub_t::xattach_pipes (class reader_t *inpipe_,
>       class writer_t *outpipe_, const blob_t&peer_identity_)
>   {
> +     if (!inpipe_ || outpipe_)
> +        printf ("E: you connected SUB to SUB, please fix your code\n");
>       zmq_assert (inpipe_&&  !outpipe_);
>       fq.attach (inpipe_);
>   }




More information about the zeromq-dev mailing list