[nanomsg] Blocking distributor (dist.h, dist.c)

  • From: Pietro Masala <pietro.masala@xxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Wed, 19 Apr 2017 18:24:49 +0200

Dear all,

I'm trying to set-up a variant of the scalable protocol distributor utility
(dist.h, dist.c) that try to distribute a message to all the connected
pipes, and blocks in case unserved connected pipes are not available.

This in case best-effort policy is not needed, and when it is useful to
reduce message loss.

I know, as suggested in some post, that this can (and maybe should in most
cases) be done at application level. But in my case it is important to
separate this aspect by the rest of the application, and I find convenient
to consider the "best-effort" policy as part of the SP.

My distributor send routine shall return 0 when all the connected pipes
have been served, in order to let the nn_sock_send routine (and the user)
unblock.

If not all the connected pipes have been served, the send distribution
routine shall return EAGAIN in order to keep the nn_sock_send routine
blocked waiting for the connected pipes to be available for send.

In case the SOL timeout option is set by the user, the send operation shall
be unblocked.

My problem is how to be notified, at the distribution level, that the
nn_efd_wait timeout has been expired (or exited with errors) in
nn_sock_send, in order to clear the distribution temporary data for the
next send operation.

Infact, the nn_sockbase interface does not have any function to notify to
the SP that the running operation has been aborted.

have any idea, comment or solution, is welcome.

Thank you,

Pietro

Other related posts: