aboutsummaryrefslogtreecommitdiff
path: root/src/transport/tcp
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-04-14 12:46:15 -0700
committerGarrett D'Amore <garrett@damore.org>2018-04-14 12:46:15 -0700
commit5dfd550c68284438aeaacbaef815fc7d2f75f068 (patch)
treef6e1d0139e673f133cdcc4114977f5b67689c80d /src/transport/tcp
parentc66ef25c7dfd0c2a3c4a8aa8eea223fa186c2311 (diff)
downloadnng-5dfd550c68284438aeaacbaef815fc7d2f75f068.tar.gz
nng-5dfd550c68284438aeaacbaef815fc7d2f75f068.tar.bz2
nng-5dfd550c68284438aeaacbaef815fc7d2f75f068.zip
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*.
Diffstat (limited to 'src/transport/tcp')
-rw-r--r--src/transport/tcp/tcp.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c
index 80b372e9..7ea77035 100644
--- a/src/transport/tcp/tcp.c
+++ b/src/transport/tcp/tcp.c
@@ -48,7 +48,6 @@ struct nni_tcp_ep {
nni_plat_tcp_ep *tep;
uint16_t proto;
size_t rcvmax;
- nni_duration linger;
nni_aio * aio;
nni_aio * user_aio;
nni_url * url;
@@ -795,26 +794,6 @@ nni_tcp_ep_getopt_recvmaxsz(void *arg, void *v, size_t *szp, int typ)
return (nni_copyout_size(ep->rcvmax, v, szp, typ));
}
-static int
-nni_tcp_ep_setopt_linger(void *arg, const void *v, size_t sz, int typ)
-{
- nni_tcp_ep * ep = arg;
- nng_duration val;
- int rv;
-
- if (((rv = nni_copyin_ms(&val, v, sz, typ)) == 0) && (ep != NULL)) {
- ep->linger = val;
- }
- return (rv);
-}
-
-static int
-nni_tcp_ep_getopt_linger(void *arg, void *v, size_t *szp, int typ)
-{
- nni_tcp_ep *ep = arg;
- return (nni_copyout_ms(ep->linger, v, szp, typ));
-}
-
static nni_tran_pipe_option nni_tcp_pipe_options[] = {
{
.po_name = NNG_OPT_LOCADDR,
@@ -855,12 +834,6 @@ static nni_tran_ep_option nni_tcp_ep_options[] = {
.eo_getopt = nni_tcp_ep_getopt_url,
.eo_setopt = NULL,
},
- {
- .eo_name = NNG_OPT_LINGER,
- .eo_type = NNI_TYPE_DURATION,
- .eo_getopt = nni_tcp_ep_getopt_linger,
- .eo_setopt = nni_tcp_ep_setopt_linger,
- },
// terminate list
{
.eo_name = NULL,