[nanomsg] cppnanomsg throws on recv if survey timed out

  • From: Daniel Hofmann <daniel@xxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Wed, 14 Jan 2015 21:42:57 +0100

The cppnanomsg C++ wrapper translates error codes into exceptions, only
if they are fatal.

The recv wrapper throws on errors, except for EAGAIN. [0]

Therefore it also throws on EFSM / ETIMEDOUT, making it useless for the
survey pattern when there might be an expired deadline.

I'm not even able to catch the exception and handle the expired deadline
event, because there's just the generic exception type that may also
indicate fatal errors.

I think the expired survey deadline should not force recv to throw, but
simply to return the error.

As I see it an expired deadline returns EFSM (instead of ETIMEDOUT),
making this impossible to implement only for survey.

Using this wrapper, how am I supposed to use nn_survey?
What do you think?

Thanks,
Daniel


[0]
https://github.com/nanomsg/cppnanomsg/blob/a36d44db1827a36bbd3868825c1b82d23f10e491/nn.hpp#L151-L160

Other related posts:

  • » [nanomsg] cppnanomsg throws on recv if survey timed out - Daniel Hofmann