[zeromq-dev] Handling errors from OpenPGM call pgm_recv() and friends

Martin Sustrik sustrik at 250bpm.com
Tue Dec 22 09:02:11 CET 2009


Steven,

> The domains allow for separate namespaces for error codes, which means 
> PGM_IF_ERROR_INVAL has the same code value as 
>  PGM_TRANSPORT_ERROR_FAULT, meaning you will want to change the code to 
> something like this,
> 
>    if (!pgm_transport_bind (transport, &pgm_error)) {
>        if (pgm_error->domain == PGM_IF_ERROR &&
>             (pgm_error->code == PGM_IF_ERROR_INVAL ||
>              pgm_error->code == PGM_IF_ERROR_XDEV ||
>              pgm_error->code == PGM_IF_ERROR_NODEV ||
>              pgm_error->code == PGM_IF_ERROR_NOTUNIQ ||
>              pgm_error->code == PGM_IF_ERROR_ADDRFAMILY ||
>              pgm_error->code == PGM_IF_ERROR_FAMILY ||
>              pgm_error->code == PGM_IF_ERROR_NODATA ||
>              pgm_error->code == PGM_IF_ERROR_NONAME ||
>              pgm_error->code == PGM_IF_ERROR_SERVICE)) {
>            g_error_free (pgm_error);
>            errno = EINVAL;
>            return -1;
>        }
> 
>        zmq_assert (false);
>    }

Ok. Fixed. Thanks for the advice.

Martin



More information about the zeromq-dev mailing list