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

Steven McCoy steven.mccoy at miru.hk
Fri Dec 18 05:55:58 CET 2009


Finally,

        const PGMIOStatus status = pgm_recvmsgv (transport, pgm_msgv,
            pgm_msgv_len, MSG_DONTWAIT, &nbytes_rec, &pgm_error);

and

    PGMIOStatus status = pgm_recvmsgv (transport, &dummy_msg,
        1, MSG_DONTWAIT, &dummy_bytes, &pgm_error);

Similarly have memory leaks on failure.

If the PGMIOStatus return value is PGM_IO_STATUS_RESET you can see a
mesage from PGM_RECV_ERROR domain,

	PGM_RECV_ERROR_CONNRESET
		Transport has been reset on unrecoverable loss from %s.

NB:  Set the MSG_ERRQUEUE flag to withold the generation of the error text.


If the PGMIOStatus return value is PGM_IO_STATUS_ERROR the GError may
be set to the following from the PGM_RECV_ERROR domain, recvmsg(2),
select(2), poll(2) derived errors,

	EBADF          -> PGM_RECV_ERROR_BADF
	EFAULT         -> PGM_RECV_ERROR_FAULT
	EINTR          -> PGM_RECV_ERROR_INTR
	EINVAL         -> PGM_RECV_ERROR_INVAL
	ENOMEM         -> PGM_RECV_ERROR_NOMEM
	*              -> PGM_RECV_ERROR_FAILED   /* catch all */

	WSAEINVAL      -> PGM_RECV_ERROR_INVAL
	WSAEMFILE      -> PGM_RECV_ERROR_MFILE
	WSA_NOT_ENOUGH_MEMORY -> PGM_RECV_ERROR_NOMEM
	WSAENOPROTOOPT -> PGM_RECV_ERROR_NOPROTOOPT
	WSAECONNRESET  -> PGM_RECV_ERROR_CONNRESET
	*              -> PGM_RECV_ERROR_FAILED   /* catch all */

		Transport socket error: %s
		Waiting for event: %s

-- 
Steve-o



More information about the zeromq-dev mailing list