From be13c2e8845423cec17af429fc4e16a5d9749e47 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 26 Oct 2025 10:54:58 -0700 Subject: Replace nng_pipe_get_addr, nng_stream_get_addr, and the NNG_OPT_REMADDR option. More direct access methods are provided instead. This results in much lower friction when using, and is a step on the path to removing NNG_OPT_LOCADDR as well. We need to figure a solution for NNG_OPT_LOCADDR for dialers; for listeners there is little use in it either, and it will be removed. (Dialers will probably get a new NNG_OPT_BIND_IP option.) --- src/sp/transport/udp/udp.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'src/sp/transport/udp/udp.c') diff --git a/src/sp/transport/udp/udp.c b/src/sp/transport/udp/udp.c index 02eb088a..016c222b 100644 --- a/src/sp/transport/udp/udp.c +++ b/src/sp/transport/udp/udp.c @@ -993,27 +993,11 @@ udp_pipe_get_recvmax(void *arg, void *v, size_t *szp, nni_type t) return (rv); } -static nng_err -udp_pipe_get_remaddr(void *arg, void *v, size_t *szp, nni_type t) -{ - udp_pipe *p = arg; - udp_ep *ep = p->ep; - nng_err rv; - nni_mtx_lock(&ep->mtx); - rv = nni_copyout_sockaddr(&p->peer_addr, v, szp, t); - nni_mtx_unlock(&ep->mtx); - return (rv); -} - static nni_option udp_pipe_options[] = { { .o_name = NNG_OPT_RECVMAXSZ, .o_get = udp_pipe_get_recvmax, }, - { - .o_name = NNG_OPT_REMADDR, - .o_get = udp_pipe_get_remaddr, - }, { .o_name = NULL, }, @@ -1546,22 +1530,6 @@ udp_ep_get_locaddr(void *arg, void *v, size_t *szp, nni_opt_type t) return (rv); } -static nng_err -udp_ep_get_remaddr(void *arg, void *v, size_t *szp, nni_opt_type t) -{ - udp_ep *ep = arg; - nng_err rv; - nng_sockaddr sa; - - if (!ep->dialer) { - return (NNG_ENOTSUP); - } - sa = ep->peer_sa; - - rv = nni_copyout_sockaddr(&sa, v, szp, t); - return (rv); -} - static nng_err udp_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t) { @@ -1735,10 +1703,6 @@ static const nni_option udp_ep_opts[] = { .o_name = NNG_OPT_LOCADDR, .o_get = udp_ep_get_locaddr, }, - { - .o_name = NNG_OPT_REMADDR, - .o_get = udp_ep_get_remaddr, - }, { .o_name = NNG_OPT_BOUND_PORT, .o_get = udp_ep_get_port, -- cgit v1.2.3-70-g09d2