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/udp/udp.c | |
| 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/udp/udp.c')
| -rw-r--r-- | src/sp/transport/udp/udp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sp/transport/udp/udp.c b/src/sp/transport/udp/udp.c index 29a516d8..ad168642 100644 --- a/src/sp/transport/udp/udp.c +++ b/src/sp/transport/udp/udp.c @@ -1801,7 +1801,7 @@ udp_ep_start(udp_ep *ep) } static int -udp_ep_bind(void *arg) +udp_ep_bind(void *arg, nng_url *url) { udp_ep *ep = arg; int rv; @@ -1817,6 +1817,9 @@ udp_ep_bind(void *arg) nni_mtx_unlock(&ep->mtx); return (rv); } + nng_sockaddr sa; + nni_plat_udp_sockname(ep->udp, &sa); + url->u_port = nng_sockaddr_port(&sa); udp_ep_start(ep); nni_mtx_unlock(&ep->mtx); |
