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/core/transport.c | |
| 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/core/transport.c')
| -rw-r--r-- | src/core/transport.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/core/transport.c b/src/core/transport.c index 0891ec8c..38f88c4d 100644 --- a/src/core/transport.c +++ b/src/core/transport.c @@ -26,7 +26,6 @@ extern nni_tran nni_ipc_tran; typedef struct nni_transport { nni_tran t_tran; - char t_prefix[16]; // e.g. "tcp://" or "tls+tcp://" nni_list_node t_node; } nni_transport; @@ -72,13 +71,6 @@ nni_tran_register(const nni_tran *tran) } t->t_tran = *tran; - sz = sizeof(t->t_prefix); - if ((nni_strlcpy(t->t_prefix, tran->tran_scheme, sz) >= sz) || - (nni_strlcat(t->t_prefix, "://", sz) >= sz)) { - nni_mtx_unlock(&nni_tran_lk); - NNI_FREE_STRUCT(t); - return (NNG_EINVAL); - } if ((rv = t->t_tran.tran_init()) != 0) { nni_mtx_unlock(&nni_tran_lk); NNI_FREE_STRUCT(t); @@ -90,14 +82,14 @@ nni_tran_register(const nni_tran *tran) } nni_tran * -nni_tran_find(const char *addr) +nni_tran_find(nni_url *url) { // address is of the form "<scheme>://blah..." nni_transport *t; nni_mtx_lock(&nni_tran_lk); NNI_LIST_FOREACH (&nni_tran_list, t) { - if (strncmp(addr, t->t_prefix, strlen(t->t_prefix)) == 0) { + if (strcmp(url->u_scheme, t->t_tran.tran_scheme) == 0) { nni_mtx_unlock(&nni_tran_lk); return (&t->t_tran); } |
