aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-03-13 00:50:48 -0700
committerGarrett D'Amore <garrett@damore.org>2019-03-13 00:50:48 -0700
commitf723fa9655e1e7fadc1a15b94b66de674ab9fe17 (patch)
tree8788e128e723bbd936bee0b03287a49df789a116 /src/transport
parentf65f819f7fb3bbe9e24bc73342b4f335f5034fe0 (diff)
downloadnng-f723fa9655e1e7fadc1a15b94b66de674ab9fe17.tar.gz
nng-f723fa9655e1e7fadc1a15b94b66de674ab9fe17.tar.bz2
nng-f723fa9655e1e7fadc1a15b94b66de674ab9fe17.zip
fixes #815 Eliminate socket filters on message queues
This also eliminates the enforcement of NNG_OPT_RECVMAXSZ for inproc, which never really made much sense. This helps inproc go faster. While here, also clean up the entry point for protocols to support a drain option, since we don't use that anywhere.
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/inproc/inproc.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/transport/inproc/inproc.c b/src/transport/inproc/inproc.c
index 6618d794..9aef40a5 100644
--- a/src/transport/inproc/inproc.c
+++ b/src/transport/inproc/inproc.c
@@ -37,7 +37,6 @@ struct inproc_pipe {
nni_pipe * npipe;
uint16_t peer;
uint16_t proto;
- size_t rcvmax;
};
// inproc_pair represents a pair of pipes. Because we control both
@@ -61,7 +60,6 @@ struct inproc_ep {
nni_mtx mtx;
nni_dialer * ndialer;
nni_listener *nlistener;
- nni_stat_item st_rcvmaxsz;
};
// nni_inproc is our global state - this contains the list of active endpoints
@@ -115,9 +113,6 @@ inproc_pipe_alloc(inproc_pipe **pipep, inproc_ep *ep)
if ((pipe = NNI_ALLOC_STRUCT(pipe)) == NULL) {
return (NNG_ENOMEM);
}
- nni_mtx_lock(&ep->mtx);
- pipe->rcvmax = ep->rcvmax;
- nni_mtx_unlock(&ep->mtx);
pipe->proto = ep->proto;
pipe->addr = ep->addr;
@@ -229,13 +224,6 @@ inproc_dialer_init(void **epp, nni_url *url, nni_dialer *ndialer)
ep->addr = url->u_rawurl; // we match on the full URL.
- nni_stat_init(&ep->st_rcvmaxsz, "rcvmaxsz", "maximum receive size");
- nni_stat_set_type(&ep->st_rcvmaxsz, NNG_STAT_LEVEL);
- nni_stat_set_unit(&ep->st_rcvmaxsz, NNG_UNIT_BYTES);
- nni_stat_set_lock(&ep->st_rcvmaxsz, &ep->mtx);
-
- nni_dialer_add_stat(ndialer, &ep->st_rcvmaxsz);
-
*epp = ep;
return (0);
}
@@ -260,12 +248,6 @@ inproc_listener_init(void **epp, nni_url *url, nni_listener *nlistener)
ep->addr = url->u_rawurl; // we match on the full URL.
- nni_stat_init(&ep->st_rcvmaxsz, "rcvmaxsz", "maximum receive size");
- nni_stat_set_type(&ep->st_rcvmaxsz, NNG_STAT_LEVEL);
- nni_stat_set_unit(&ep->st_rcvmaxsz, NNG_UNIT_BYTES);
- nni_stat_set_lock(&ep->st_rcvmaxsz, &ep->mtx);
- nni_listener_add_stat(nlistener, &ep->st_rcvmaxsz);
-
*epp = ep;
return (0);
}
@@ -301,18 +283,6 @@ inproc_conn_finish(nni_aio *aio, int rv, inproc_ep *ep, inproc_pipe *pipe)
}
}
-static nni_msg *
-inproc_filter(void *arg, nni_msg *msg)
-{
- inproc_pipe *p = arg;
- if (p->rcvmax && (nni_msg_len(msg) > p->rcvmax)) {
- nni_pipe_bump_error(p->npipe, NNG_EMSGSIZE);
- nni_msg_free(msg);
- return (NULL);
- }
- return (msg);
-}
-
static void
inproc_ep_close(void *arg)
{
@@ -395,8 +365,6 @@ inproc_accept_clients(inproc_ep *srv)
cpipe->rq = spipe->wq = pair->q[0];
cpipe->wq = spipe->rq = pair->q[1];
- nni_msgq_set_filter(spipe->rq, inproc_filter, spipe);
- nni_msgq_set_filter(cpipe->rq, inproc_filter, cpipe);
inproc_conn_finish(caio, 0, cli, cpipe);
inproc_conn_finish(saio, 0, srv, spipe);
}
@@ -541,7 +509,6 @@ inproc_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
- nni_stat_set_value(&ep->st_rcvmaxsz, val);
nni_mtx_unlock(&ep->mtx);
}
return (rv);