From 5dfd550c68284438aeaacbaef815fc7d2f75f068 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 14 Apr 2018 12:46:15 -0700 Subject: fixes #308 Close can block Ultimately, this just removes the support for lingering altogether. Based on prior experience, lingering has always been unreliable, and was removed in legacy libnanomsg ages ago. The problem is that operating system support for lingering is very inconsistent at best, and for some transports the very concept is somewhat meaningless. Making things worse, we were never able to adequately capture an exit() event from another thread -- so lingering was always a false promise. Applications that need to be sure that messages are delivered should either include an ack in their protocol, use req/rep (which has an ack), or inject a suitable delay of their own. For things going over local networks, an extra delay of 100 msec should be sufficient *most of the time*. --- tests/sock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/sock.c b/tests/sock.c index c4de6ad4..17ea055d 100644 --- a/tests/sock.c +++ b/tests/sock.c @@ -471,10 +471,10 @@ TestMain("Socket Operations", { So(nng_listener_getopt_int(1999, NNG_OPT_RAW, &i) == NNG_ENOENT); - So(nng_dialer_getopt_ms(1999, NNG_OPT_LINGER, &t) == - NNG_ENOENT); - So(nng_listener_getopt_ms(1999, NNG_OPT_LINGER, &t) == + So(nng_dialer_getopt_ms(1999, NNG_OPT_RECVTIMEO, &t) == NNG_ENOENT); + So(nng_listener_getopt_ms( + 1999, NNG_OPT_SENDTIMEO, &t) == NNG_ENOENT); }); -- cgit v1.2.3-70-g09d2