aboutsummaryrefslogtreecommitdiff
path: root/src/transport/ws
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/ws
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/ws')
-rw-r--r--src/transport/ws/websocket.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/transport/ws/websocket.c b/src/transport/ws/websocket.c
index 4db4bc72..aead6f59 100644
--- a/src/transport/ws/websocket.c
+++ b/src/transport/ws/websocket.c
@@ -30,8 +30,7 @@ typedef struct ws_hdr {
} ws_hdr;
struct ws_ep {
- int mode; // NNI_EP_MODE_DIAL or NNI_EP_MODE_LISTEN
- char * addr;
+ int mode; // NNI_EP_MODE_DIAL or NNI_EP_MODE_LISTEN
uint16_t lproto; // local protocol
uint16_t rproto; // remote protocol
size_t rcvmax;
@@ -605,7 +604,6 @@ ws_ep_fini(void *arg)
nni_strfree(hdr->value);
NNI_FREE_STRUCT(hdr);
}
- nni_strfree(ep->addr);
nni_strfree(ep->protoname);
nni_mtx_fini(&ep->mtx);
NNI_FREE_STRUCT(ep);
@@ -694,7 +692,7 @@ ws_ep_acc_cb(void *arg)
}
static int
-ws_ep_init(void **epp, const char *url, nni_sock *sock, int mode)
+ws_ep_init(void **epp, nni_url *url, nni_sock *sock, int mode)
{
ws_ep * ep;
const char *pname;
@@ -721,9 +719,6 @@ ws_ep_init(void **epp, const char *url, nni_sock *sock, int mode)
rv = nni_ws_listener_init(&ep->listener, url);
}
- if ((rv == 0) && ((ep->addr = nni_strdup(url)) == NULL)) {
- rv = NNG_ENOMEM;
- }
if ((rv != 0) ||
((rv = nni_aio_init(&ep->connaio, ws_ep_conn_cb, ep)) != 0) ||
((rv = nni_aio_init(&ep->accaio, ws_ep_acc_cb, ep)) != 0) ||