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/zerotier | |
| 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/zerotier')
| -rw-r--r-- | src/transport/zerotier/zerotier.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/transport/zerotier/zerotier.c b/src/transport/zerotier/zerotier.c index cef31a29..2522138f 100644 --- a/src/transport/zerotier/zerotier.c +++ b/src/transport/zerotier/zerotier.c @@ -225,7 +225,6 @@ struct zt_creq { struct zt_ep { nni_list_node ze_link; - char ze_url[NNG_MAXADDRLEN]; char ze_home[NNG_MAXADDRLEN]; // should be enough zt_node * ze_ztn; uint64_t ze_nwid; @@ -2100,7 +2099,7 @@ zt_parsedec(const char **sp, uint64_t *valp) } static int -zt_ep_init(void **epp, const char *url, nni_sock *sock, int mode) +zt_ep_init(void **epp, nni_url *url, nni_sock *sock, int mode) { zt_ep * ep; size_t sz; @@ -2127,24 +2126,18 @@ zt_ep_init(void **epp, const char *url, nni_sock *sock, int mode) ep->ze_ping_count = zt_ping_count; ep->ze_ping_time = zt_ping_time; ep->ze_proto = nni_sock_proto(sock); - sz = sizeof(ep->ze_url); nni_aio_list_init(&ep->ze_aios); - if ((strncmp(url, "zt://", strlen("zt://")) != 0) || - (nni_strlcpy(ep->ze_url, url, sz) >= sz)) { - zt_ep_fini(ep); - return (NNG_EADDRINVAL); - } rv = nni_aio_init(&ep->ze_creq_aio, zt_ep_conn_req_cb, ep); if (rv != 0) { zt_ep_fini(ep); return (rv); } - u = url + strlen("zt://"); - // Parse the URL. + u = url->u_rawurl + strlen("zt://"); + // Parse the URL. switch (mode) { case NNI_EP_MODE_DIAL: // We require zt://<nwid>/<remotenode>:<port> |
