[nanomsg] NNG API changes….

  • From: "Garrett D'Amore" <garrett@xxxxxxxxxx>
  • To: "nanomsg@xxxxxxxxxxxxx" <nanomsg@xxxxxxxxxxxxx>
  • Date: Fri, 27 Apr 2018 02:37:05 +0000

I’ve just pushed my changes to convert the types for nng_socket,
nng_dialer, nng_endpoint, nng_pipe, and nng_ctx into opaque structures.
Any user code that assumed that these were integer values, or did direct
comparisons of values is probably broken.  But really, you shouldn’t need
to do that, right?

Also, today I’ve added support for TCP nodelay (NNG_OPT_TCP_NODELAY) and
keepalive (NNG_OPT_TCP_KEEPALIVE) properties for both tcp:// and tls+tcp://
schemes.  These are both boolean.  Nodelay disables Nagle’s algorithm, and
is “true” by default  now.  (Meaning we do *NOT* use Nagle’s algorithm by
default.)  This is superior in almost every situation — unless you’re
sending messages over an extremely low bandwidth network (think 300 baud
modems) Nagle isn’t something you want with a message oriented protocol.
This will probably help latency using TCP or TLS for some of you, and it
will definitely improve the setup latency for TLS connection establishment.

KeepAlive is off by default.  (The tradeoff here is that keepalive can wind
up keeping computers from completely sleeping during quiescent network
periods, but will help to ensure that dead peers are noticed and that any
middle boxes like NAT appliances don’t drop table entries because they
think the session is dead.)

I’d be willing to contemplate enabling TCP keepalive by default, and may do
so in the future.  If you have a need for the setting to be one way or the
other on *either* of these, you should set it explicitly rather than
relying on the default value.

(Speaking of keepalive — I am *not* offering any way to tune the timers or
retry counts associated with keepalives.  Please let me know with a
justification if you need that.  For now I’ve assumed the complexity and
hit to portability offsets any positive value it may have.)

 - Garrett
 - Garrett

Other related posts:

  • » [nanomsg] NNG API changes…. - Garrett D'Amore