diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/pipe.c | 28 | ||||
| -rw-r--r-- | src/core/pipe.h | 11 | ||||
| -rw-r--r-- | src/core/platform.h | 4 | ||||
| -rw-r--r-- | src/platform/posix/posix_aiothr.c | 3 | ||||
| -rw-r--r-- | src/transport/tcp/tcp.c | 66 |
5 files changed, 1 insertions, 111 deletions
diff --git a/src/core/pipe.c b/src/core/pipe.c index 4b37cfa9..bc77cd2d 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -23,20 +23,6 @@ nni_pipe_id(nni_pipe *p) int -nni_pipe_send(nni_pipe *p, nng_msg *msg) -{ - return (p->p_tran_ops.pipe_send(p->p_tran_data, msg)); -} - - -int -nni_pipe_recv(nni_pipe *p, nng_msg **msgp) -{ - return (p->p_tran_ops.pipe_recv(p->p_tran_data, msgp)); -} - - -int nni_pipe_aio_recv(nni_pipe *p, nni_aio *aio) { return (p->p_tran_ops.p_aio_recv(p->p_tran_data, aio)); @@ -233,20 +219,6 @@ nni_pipe_get_proto_data(nni_pipe *p) void -nni_pipe_set_tran_data(nni_pipe *p, void *data) -{ - p->p_tran_data = data; -} - - -void * -nni_pipe_get_tran_data(nni_pipe *p) -{ - return (p->p_tran_data); -} - - -void nni_pipe_sock_list_init(nni_list *list) { NNI_LIST_INIT(list, nni_pipe, p_sock_node); diff --git a/src/core/pipe.h b/src/core/pipe.h index 71f3821a..912c70bd 100644 --- a/src/core/pipe.h +++ b/src/core/pipe.h @@ -37,8 +37,6 @@ extern int nni_pipe_aio_recv(nni_pipe *, nni_aio *); extern int nni_pipe_aio_send(nni_pipe *, nni_aio *); // Pipe operations that protocols use. -extern int nni_pipe_recv(nni_pipe *, nng_msg **); -extern int nni_pipe_send(nni_pipe *, nng_msg *); extern uint32_t nni_pipe_id(nni_pipe *); extern void nni_pipe_close(nni_pipe *); extern void nni_pipe_incref(nni_pipe *); @@ -64,15 +62,6 @@ extern void nni_pipe_set_proto_data(nni_pipe *, void *); // nni_pipe_set_proto_data function. No locking is performed. extern void *nni_pipe_get_proto_data(nni_pipe *); -// nni_pipe_set_tran_data sets the transport private data. No locking is -// performed, and this routine should only be called once per pipe at -// initialization. -extern void nni_pipe_set_tran_data(nni_pipe *, void *); - -// nni_pipe_get_tran_data gets the transport private data set with the -// nni_pipe_set_tran_data function. No locking is performed. -extern void *nni_pipe_get_tran_data(nni_pipe *); - // nni_pipe_sock_list_init initializes a list of pipes, to be used by // a per-socket list. extern void nni_pipe_sock_list_init(nni_list *); diff --git a/src/core/platform.h b/src/core/platform.h index 1644973c..e6eac8e3 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -208,13 +208,11 @@ extern int nni_plat_tcp_connect(nni_plat_tcpsock *, const nni_sockaddr *, // of iovs will never be larger than 4. The platform may modify the iovs, // or the iov list. extern int nni_plat_tcp_aio_send(nni_plat_tcpsock *, nni_aio *); -extern int nni_plat_tcp_send(nni_plat_tcpsock *, nni_iov *, int); -// nni_plat_tcp_recv recvs data into the buffers provided by the +// nni_plat_tcp_aio_recv recvs data into the buffers provided by the // iovs. The implementation does not return until the iovs are completely // full, or an error condition occurs. extern int nni_plat_tcp_aio_recv(nni_plat_tcpsock *, nni_aio *); -extern int nni_plat_tcp_recv(nni_plat_tcpsock *, nni_iov *, int); // nni_plat_ipc_init initializes the socket, for example it can // set underlying file descriptors to -1, etc. diff --git a/src/platform/posix/posix_aiothr.c b/src/platform/posix/posix_aiothr.c index 2d31aede..2c11dcb2 100644 --- a/src/platform/posix/posix_aiothr.c +++ b/src/platform/posix/posix_aiothr.c @@ -178,7 +178,6 @@ nni_plat_aiothr_dothr(nni_posix_aioq *q, int (*fn)(int, nni_aio *)) } nni_list_remove(&q->aq_aios, aio); - //nni_mtx_unlock(&q->aq_lk); // Call the callback. nni_aio_finish(aio, rv, aio->a_count); @@ -186,9 +185,7 @@ nni_plat_aiothr_dothr(nni_posix_aioq *q, int (*fn)(int, nni_aio *)) while ((aio = nni_list_first(&q->aq_aios)) != NULL) { nni_list_remove(&q->aq_aios, aio); - //nni_mtx_unlock(&q->aq_lk); nni_aio_finish(aio, NNG_ECLOSED, aio->a_count); - //nni_mtx_lock(&q->aq_lk); } nni_mtx_unlock(&q->aq_lk); diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c index f220e49e..1cf64768 100644 --- a/src/transport/tcp/tcp.c +++ b/src/transport/tcp/tcp.c @@ -259,72 +259,6 @@ nni_tcp_pipe_aio_recv(void *arg, nni_aio *aio) } -static int -nni_tcp_pipe_send(void *arg, nni_msg *msg) -{ -#if 0 - nni_tcp_pipe *pipe = arg; - uint64_t len; - uint8_t buf[sizeof (len)]; - nni_iov iov[3]; - int rv; - - iov[0].iov_buf = buf; - iov[0].iov_len = sizeof (buf); - iov[1].iov_buf = nni_msg_header(msg); - iov[1].iov_len = nni_msg_header_len(msg); - iov[2].iov_buf = nni_msg_body(msg); - iov[2].iov_len = nni_msg_len(msg); - - len = (uint64_t) iov[1].iov_len + (uint64_t) iov[2].iov_len; - NNI_PUT64(buf, len); - - if ((rv = nni_plat_tcp_send(pipe->tsp, iov, 3)) == 0) { - nni_msg_free(msg); - } - return (rv); - -#endif - return (NNG_EINVAL); -} - - -static int -nni_tcp_pipe_recv(void *arg, nni_msg **msgp) -{ - nni_tcp_pipe *pipe = arg; - nni_msg *msg; - uint64_t len; - uint8_t buf[sizeof (len)]; - nni_iov iov[1]; - int rv; - - iov[0].iov_buf = buf; - iov[0].iov_len = sizeof (buf); - if ((rv = nni_plat_tcp_recv(pipe->tsp, iov, 1)) != 0) { - return (rv); - } - NNI_GET64(buf, len); - if (len > pipe->rcvmax) { - return (NNG_EMSGSIZE); - } - - if ((rv = nng_msg_alloc(&msg, (size_t) len)) != 0) { - return (rv); - } - - iov[0].iov_len = nng_msg_len(msg); - iov[0].iov_buf = nng_msg_body(msg); - - if ((rv = nni_plat_tcp_recv(pipe->tsp, iov, 1)) == 0) { - *msgp = msg; - } else { - nni_msg_free(msg); - } - return (rv); -} - - static uint16_t nni_tcp_pipe_peer(void *arg) { |
