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

  • From: Pietro Masala <pietro.masala@xxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Thu, 20 Apr 2017 05:07:12 +0200

Thank you Garrett,

I Will have a look at libnng.

Pietro



Il 19 apr 2017 19:12, "Garrett D'Amore" <garrett@xxxxxxxxxx> ha scritto:

To be honest I think you are going to struggle with nanomsgs internal
state machinery.  You may be able to make these changes but were I you I
would take one of two different paths.

a) if you need this asap I would still do this at the application level,
possibly injecting a new library if isolation is a concern.

b) if you have a little more time I would look at the new libnng.  its
still not ready yet but it is usable at least on linux, and can be
considered alpha level for development purposes.  look especially at the
asyncagain branch which represents the new async model for it. i think you
may find this library easier to extend than libnanomsg.  and it offers the
same legacy api for apps so porting apps should be a cinch.

Sent from my iPhone

On Apr 19, 2017, at 6:24 AM, Pietro Masala <pietro.masala@xxxxxxxxx>
wrote:

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: