diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-24 17:52:35 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-24 17:52:35 -0800 |
| commit | 269fd9ab6f2091968712849444483661f6b47f6b (patch) | |
| tree | 1be2d8bd44cb8c18d14ddbcb825aa1fc58bf7d1a /src | |
| parent | 9c987ebb745a244ffbf80dcafb473eac6a69f21b (diff) | |
| download | nng-269fd9ab6f2091968712849444483661f6b47f6b.tar.gz nng-269fd9ab6f2091968712849444483661f6b47f6b.tar.bz2 nng-269fd9ab6f2091968712849444483661f6b47f6b.zip | |
tls: don't use an extra resolver step in the listener.
This was centralized in the stream layer a while ago.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp/transport/tls/tls.c | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c index 00d2554d..9d02b528 100644 --- a/src/sp/transport/tls/tls.c +++ b/src/sp/transport/tls/tls.c @@ -863,23 +863,8 @@ tlstran_ep_init_listener(void **lp, nng_url *url, nni_listener *nlistener) { tlstran_ep *ep; int rv; - uint16_t af; - char *host = url->u_hostname; - nni_aio *aio; nni_sock *sock = nni_listener_sock(nlistener); - if (strcmp(url->u_scheme, "tls+tcp") == 0) { - af = NNG_AF_UNSPEC; - } else if (strcmp(url->u_scheme, "tls+tcp4") == 0) { - af = NNG_AF_INET; -#ifdef NNG_ENABLE_IPV6 - } else if (strcmp(url->u_scheme, "tls+tcp6") == 0) { - af = NNG_AF_INET6; -#endif - } else { - return (NNG_EADDRINVAL); - } - // Check for invalid URL components. if ((strlen(url->u_path) != 0) && (strcmp(url->u_path, "/") != 0)) { return (NNG_EADDRINVAL); @@ -890,30 +875,7 @@ tlstran_ep_init_listener(void **lp, nng_url *url, nni_listener *nlistener) } if (((rv = tlstran_ep_init(&ep, url, sock)) != 0) || ((rv = nni_aio_alloc(&ep->connaio, tlstran_accept_cb, ep)) != 0) || - ((rv = nni_aio_alloc(&ep->timeaio, tlstran_timer_cb, ep)) != 0)) { - return (rv); - } - - if (strlen(host) == 0) { - host = NULL; - } - - // XXX: We are doing lookup at listener initialization. There is - // a valid argument that this should be done at bind time, but that - // would require making bind asynchronous. In some ways this would - // be worse than the cost of just waiting here. We always recommend - // using local IP addresses rather than names when possible. - - if ((rv = nni_aio_alloc(&aio, NULL, NULL)) != 0) { - tlstran_ep_fini(ep); - return (rv); - } - nni_resolv_ip(host, url->u_port, af, true, &ep->sa, aio); - nni_aio_wait(aio); - rv = nni_aio_result(aio); - nni_aio_free(aio); - - if ((rv != 0) || + ((rv = nni_aio_alloc(&ep->timeaio, tlstran_timer_cb, ep)) != 0) || ((rv = nng_stream_listener_alloc_url(&ep->listener, url)) != 0)) { tlstran_ep_fini(ep); return (rv); |
