diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-21 22:48:32 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-21 22:48:32 -0800 |
| commit | 925ac884f8bce34ad27fe18e851ebcecfe311356 (patch) | |
| tree | f5ef6ed18876688a695af49a89df12114505f65f /src/sp/transport/tls | |
| parent | 7ea8abadec355eb7ea9f71fc2e2bdd73c1c77c62 (diff) | |
| download | nng-925ac884f8bce34ad27fe18e851ebcecfe311356.tar.gz nng-925ac884f8bce34ad27fe18e851ebcecfe311356.tar.bz2 nng-925ac884f8bce34ad27fe18e851ebcecfe311356.zip | |
Collect the bound port as part of the URL at bind time.
This is a step on cleaning up our logic around NNG_OPT_URL.
Diffstat (limited to 'src/sp/transport/tls')
| -rw-r--r-- | src/sp/transport/tls/tls.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c index 394eb561..929e3f8e 100644 --- a/src/sp/transport/tls/tls.c +++ b/src/sp/transport/tls/tls.c @@ -14,6 +14,7 @@ #include "core/nng_impl.h" +#include "nng/nng.h" #include "nng/supplemental/tls/tls.h" // TLS over TCP transport. Platform specific TCP operations must be @@ -970,13 +971,19 @@ tlstran_ep_connect(void *arg, nni_aio *aio) } static int -tlstran_ep_bind(void *arg) +tlstran_ep_bind(void *arg, nng_url *url) { tlstran_ep *ep = arg; int rv; nni_mtx_lock(&ep->mtx); rv = nng_stream_listener_listen(ep->listener); + if (rv == 0) { + int port; + nng_stream_listener_get_int( + ep->listener, NNG_OPT_TCP_BOUND_PORT, &port); + url->u_port = (uint32_t) port; + } nni_mtx_unlock(&ep->mtx); return (rv); |
