diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-01-22 14:05:10 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-01-22 17:11:58 -0800 |
| commit | 3d075fad7496ec126c5087d1c36ab7a4af73ce16 (patch) | |
| tree | c5b5d6fe44eaa2996310683b5080de87160b9b41 /src/transport/tcp | |
| parent | 5b1a3af7be4ae712868ae84b9a7d5a974d272b16 (diff) | |
| download | nng-3d075fad7496ec126c5087d1c36ab7a4af73ce16.tar.gz nng-3d075fad7496ec126c5087d1c36ab7a4af73ce16.tar.bz2 nng-3d075fad7496ec126c5087d1c36ab7a4af73ce16.zip | |
fixes #219 transports should take URL structure instead of string address
This eliminates a bunch of redundant URL parsing, using the common
URL logic we already have in place.
While here I fixed a problem with the TLS and WSS test suites that
was failing on older Ubuntu -- apparently older versions of mbedTLS
were unhappy if selecting OPTIONAL verification without a validate
certificate chain.
Diffstat (limited to 'src/transport/tcp')
| -rw-r--r-- | src/transport/tcp/tcp.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c index 9110e31c..0a123a79 100644 --- a/src/transport/tcp/tcp.c +++ b/src/transport/tcp/tcp.c @@ -527,14 +527,13 @@ nni_tcp_ep_fini(void *arg) if (ep->tep != NULL) { nni_plat_tcp_ep_fini(ep->tep); } - nni_url_free(ep->url); nni_aio_fini(ep->aio); nni_mtx_fini(&ep->mtx); NNI_FREE_STRUCT(ep); } static int -nni_tcp_ep_init(void **epp, const char *addr, nni_sock *sock, int mode) +nni_tcp_ep_init(void **epp, nni_url *url, nni_sock *sock, int mode) { nni_tcp_ep * ep; int rv; @@ -543,24 +542,17 @@ nni_tcp_ep_init(void **epp, const char *addr, nni_sock *sock, int mode) nni_sockaddr rsa, lsa; nni_aio * aio; int passive; - nni_url * url; - if ((rv = nni_url_parse(&url, addr)) != 0) { - return (rv); - } // Check for invalid URL components. if ((strlen(url->u_path) != 0) && (strcmp(url->u_path, "/") != 0)) { - nni_url_free(url); return (NNG_EADDRINVAL); } if ((url->u_fragment != NULL) || (url->u_userinfo != NULL) || (url->u_query != NULL)) { - nni_url_free(url); return (NNG_EADDRINVAL); } if ((rv = nni_aio_init(&aio, NULL, NULL)) != 0) { - nni_url_free(url); return (rv); } @@ -582,7 +574,6 @@ nni_tcp_ep_init(void **epp, const char *addr, nni_sock *sock, int mode) lsa.s_un.s_family = NNG_AF_UNSPEC; aio->a_addr = &rsa; if ((host == NULL) || (serv == NULL)) { - nni_url_free(url); nni_aio_fini(aio); return (NNG_EADDRINVAL); } @@ -595,7 +586,6 @@ nni_tcp_ep_init(void **epp, const char *addr, nni_sock *sock, int mode) nni_plat_tcp_resolv(host, serv, NNG_AF_UNSPEC, passive, aio); nni_aio_wait(aio); if ((rv = nni_aio_result(aio)) != 0) { - nni_url_free(url); nni_aio_fini(aio); return (rv); } @@ -603,7 +593,6 @@ nni_tcp_ep_init(void **epp, const char *addr, nni_sock *sock, int mode) nni_aio_fini(aio); if ((ep = NNI_ALLOC_STRUCT(ep)) == NULL) { - nni_url_free(url); return (NNG_ENOMEM); } nni_mtx_init(&ep->mtx); |
