fixes #799 NN_LINGER not implemented
diff --git a/doc/nn_setsockopt.txt b/doc/nn_setsockopt.txt
index 3e53371..cc2d912 100644
--- a/doc/nn_setsockopt.txt
+++ b/doc/nn_setsockopt.txt
@@ -27,11 +27,6 @@
_<nanomsg/nn.h>_ header defines generic socket-level options
(_NN_SOL_SOCKET_ level). The options are as follows:
-*NN_LINGER*::
- Specifies how long the socket should try to send pending outbound messages
- after _nn_close()_ have been called, in milliseconds. Negative value means
- infinite linger. The type of the option is int. Default value
- is 1000 (1 second).
*NN_SNDBUF*::
Size of the send buffer, in bytes. To prevent blocking for messages larger
than the buffer, exactly one message may be buffered in addition to the data
@@ -95,6 +90,13 @@
it is dropped. Each time the message is received (for example via
the <<nn_device.3.txt#,nn_device(3)>> function) counts as a single hop.
This provides a form of protection against inadvertent loops.
+*NN_LINGER*::
+ This option is not implemented, and should not be used in new code.
+ Applications which need to be sure that their messages are delivered
+ to a remote peer should either use an acknowledgement (implied when
+ receiving a reply on <<nn_reqrep.7.txt#,NN_REQ>> sockets), or insert
+ a suitable delay before calling <<nn_close.3.txt#,nn_close(3)>> or
+ exiting the application.
diff --git a/src/core/sock.c b/src/core/sock.c
index 4db7d49..6213860 100644
--- a/src/core/sock.c
+++ b/src/core/sock.c
@@ -122,7 +122,6 @@
self->eid = 1;
/* Default values for NN_SOL_SOCKET options. */
- self->linger = 1000;
self->sndbuf = 128 * 1024;
self->rcvbuf = 128 * 1024;
self->rcvmaxsize = 1024 * 1024;
@@ -322,9 +321,6 @@
/* Generic socket-level options. */
switch (option) {
- case NN_LINGER:
- self->linger = val;
- return 0;
case NN_SNDBUF:
if (val <= 0)
return -EINVAL;
@@ -376,6 +372,9 @@
return -EINVAL;
self->maxttl = val;
return 0;
+ case NN_LINGER:
+ /* Ignored, retained for compatibility. */
+ return 0;
}
return -ENOPROTOOPT;
@@ -425,7 +424,7 @@
intval = self->socktype->protocol;
break;
case NN_LINGER:
- intval = self->linger;
+ intval = 0;
break;
case NN_SNDBUF:
intval = self->sndbuf;
diff --git a/src/core/sock.h b/src/core/sock.h
index f87e7e9..6680674 100644
--- a/src/core/sock.h
+++ b/src/core/sock.h
@@ -72,7 +72,6 @@
int holds;
/* Socket-level socket options. */
- int linger;
int sndbuf;
int rcvbuf;
int rcvmaxsize;