aboutsummaryrefslogtreecommitdiff
path: root/src/transport/ipc
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-01-22 14:05:10 -0800
committerGarrett D'Amore <garrett@damore.org>2018-01-22 17:11:58 -0800
commit3d075fad7496ec126c5087d1c36ab7a4af73ce16 (patch)
treec5b5d6fe44eaa2996310683b5080de87160b9b41 /src/transport/ipc
parent5b1a3af7be4ae712868ae84b9a7d5a974d272b16 (diff)
downloadnng-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/ipc')
-rw-r--r--src/transport/ipc/ipc.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c
index 84292bb8..62751d86 100644
--- a/src/transport/ipc/ipc.c
+++ b/src/transport/ipc/ipc.c
@@ -529,17 +529,16 @@ nni_ipc_ep_fini(void *arg)
}
static int
-nni_ipc_ep_init(void **epp, const char *url, nni_sock *sock, int mode)
+nni_ipc_ep_init(void **epp, nni_url *url, nni_sock *sock, int mode)
{
nni_ipc_ep *ep;
int rv;
size_t sz;
- if (strncmp(url, "ipc://", strlen("ipc://")) != 0) {
- return (NNG_EADDRINVAL);
+ if (((url->u_host != NULL) && (strlen(url->u_host) > 0)) ||
+ (url->u_userinfo != NULL)) {
+ return (NNG_EINVAL);
}
- url += strlen("ipc://");
-
if ((ep = NNI_ALLOC_STRUCT(ep)) == NULL) {
return (NNG_ENOMEM);
}
@@ -547,7 +546,7 @@ nni_ipc_ep_init(void **epp, const char *url, nni_sock *sock, int mode)
sz = sizeof(ep->sa.s_un.s_path.sa_path);
ep->sa.s_un.s_path.sa_family = NNG_AF_IPC;
- if (nni_strlcpy(ep->sa.s_un.s_path.sa_path, url, sz) >= sz) {
+ if (nni_strlcpy(ep->sa.s_un.s_path.sa_path, url->u_path, sz) >= sz) {
NNI_FREE_STRUCT(ep);
return (NNG_EADDRINVAL);
}