diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-07 00:14:50 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-07 00:14:50 -0700 |
| commit | ea7d67c33ef28f4155b04b322ebbf778f1dbaa2a (patch) | |
| tree | 1fc9e4dcf8d5c508b1c3c653fff42088228c2513 /src | |
| parent | 3730260da3744b549aaa1fe13946a674f924f63c (diff) | |
| download | nng-ea7d67c33ef28f4155b04b322ebbf778f1dbaa2a.tar.gz nng-ea7d67c33ef28f4155b04b322ebbf778f1dbaa2a.tar.bz2 nng-ea7d67c33ef28f4155b04b322ebbf778f1dbaa2a.zip | |
Dead code removal (stuff for removed sync transport apis.)
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/endpt.c | 14 | ||||
| -rw-r--r-- | src/core/transport.h | 10 | ||||
| -rw-r--r-- | src/transport/tcp/tcp.c | 101 |
3 files changed, 4 insertions, 121 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c index e5a9a5bb..ddfde49e 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -266,12 +266,7 @@ nni_ep_connect_sync(nni_ep *ep) if (rv != 0) { return (rv); } - if (ep->ep_ops.ep_connect != NULL) { - rv = nni_ep_connect_aio(ep, &pipe->p_tran_data); - } else { - rv = ep->ep_ops.ep_connect_sync(ep->ep_data, - &pipe->p_tran_data); - } + rv = nni_ep_connect_aio(ep, &pipe->p_tran_data); if (rv != 0) { nni_pipe_remove(pipe); return (rv); @@ -461,12 +456,7 @@ nni_ep_accept_sync(nni_ep *ep) if (rv != 0) { return (rv); } - if (ep->ep_ops.ep_accept != NULL) { - rv = nni_ep_accept_aio(ep, &pipe->p_tran_data); - } else { - rv = ep->ep_ops.ep_accept_sync(ep->ep_data, - &pipe->p_tran_data); - } + rv = nni_ep_accept_aio(ep, &pipe->p_tran_data); if (rv != 0) { nni_pipe_remove(pipe); return (rv); diff --git a/src/core/transport.h b/src/core/transport.h index 8098e5c2..50da473d 100644 --- a/src/core/transport.h +++ b/src/core/transport.h @@ -48,10 +48,7 @@ struct nni_tran_ep { // ep_connect establishes a connection. It can return errors // NNG_EACCESS, NNG_ECONNREFUSED, NNG_EBADADDR, NNG_ECONNFAILED, - // NNG_ETIMEDOUT, and NNG_EPROTO. The first argument is the - // transport specific endpoint, and the second is a pointer to - // receive a newly created transport-specific pipe structure. - int (*ep_connect_sync)(void *, void **); + // NNG_ETIMEDOUT, and NNG_EPROTO. void (*ep_connect)(void *, nni_aio *); // ep_bind just does the bind() and listen() work, @@ -61,10 +58,7 @@ struct nni_tran_ep { // address, or NNG_EACCESS for permission problems. int (*ep_bind)(void *); - // ep_accept accepts an inbound connection. The first argument - // is the transport-specific endpoint, and the second is a pointer to - // a transport-specific pipe, created by this function. - int (*ep_accept_sync)(void *, void **); + // ep_accept accepts an inbound connection. void (*ep_accept)(void *, nni_aio *); // ep_close stops the endpoint from operating altogether. It does diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c index 237b0c07..7d66d366 100644 --- a/src/transport/tcp/tcp.c +++ b/src/transport/tcp/tcp.c @@ -549,107 +549,6 @@ nni_tcp_pipe_start(void *arg, nni_aio *aio) } -#if 0 -static int -nni_tcp_ep_connect_sync(void *arg, void **pipep) -{ - nni_tcp_ep *ep = arg; - nni_tcp_pipe *pipe; - char *host; - uint16_t port; - int flag; - char addr[NNG_MAXADDRLEN+1]; - nni_sockaddr lcladdr; - nni_sockaddr remaddr; - nni_sockaddr *bindaddr; - int rv; - - char *lclpart; - char *rempart; - - flag = ep->ipv4only ? NNI_FLAG_IPV4ONLY : 0; - snprintf(addr, sizeof (addr), "%s", ep->addr + strlen("tcp://")); - - if ((rempart = strchr(addr, ';')) != NULL) { - *rempart = '\0'; - rempart++; - lclpart = addr; - - if ((rv = nni_parseaddr(lclpart, &host, &port)) != 0) { - return (rv); - } - if ((rv = nni_plat_lookup_host(host, &lcladdr, flag)) != 0) { - return (rv); - } - // The port is in the same offset for both v4 and v6. - lcladdr.s_un.s_in.sa_port = port; - } else { - lclpart = NULL; - rempart = addr; - } - - if ((rv = nni_parseaddr(rempart, &host, &port)) != 0) { - return (rv); - } - if (host == NULL) { - return (NNG_EADDRINVAL); - } - if ((rv = nni_plat_lookup_host(host, &remaddr, flag)) != 0) { - return (rv); - } - - if ((rv = nni_tcp_pipe_init(&pipe, ep)) != 0) { - return (rv); - } - - // Port is in the same place for both v4 and v6. - remaddr.s_un.s_in.sa_port = port; - - bindaddr = lclpart == NULL ? NULL : &lcladdr; - rv = nni_plat_tcp_connect(pipe->tsp, &remaddr, bindaddr); - if (rv != 0) { - nni_tcp_pipe_fini(pipe); - return (rv); - } - - *pipep = pipe; - return (0); -} - - -static int -nni_tcp_ep_bind(void *arg) -{ - nni_tcp_ep *ep = arg; - char addr[NNG_MAXADDRLEN+1]; - char *host; - uint16_t port; - int flag; - int rv; - nni_sockaddr baddr; - - flag = ep->ipv4only ? NNI_FLAG_IPV4ONLY : 0; - - // We want to strok this, so make a copy. Skip the scheme. - snprintf(addr, sizeof (addr), "%s", ep->addr + strlen("tcp://")); - - if ((rv = nni_parseaddr(addr, &host, &port)) != 0) { - return (rv); - } - if ((rv = nni_plat_lookup_host(host, &baddr, flag)) != 0) { - return (rv); - } - baddr.s_un.s_in.sa_port = port; - - if ((rv = nni_plat_tcp_listen(ep->tsp, &baddr)) != 0) { - return (rv); - } - return (0); -} - - -#endif - static void nni_tcp_ep_fini(void *arg) { |
