diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-10-25 23:02:17 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-10-25 23:02:17 -0700 |
| commit | f9ff44ce0f0c73f05c182bb07c76bf6b51470560 (patch) | |
| tree | bc37e151ab8527ca6df85ccb079c2b03673ba319 /src/sp/transport/udp | |
| parent | c2aa8c12e705ba77f3d2d28c5ba0a9ec7efb7632 (diff) | |
| download | nng-f9ff44ce0f0c73f05c182bb07c76bf6b51470560.tar.gz nng-f9ff44ce0f0c73f05c182bb07c76bf6b51470560.tar.bz2 nng-f9ff44ce0f0c73f05c182bb07c76bf6b51470560.zip | |
Plumb sockaddrs all the way through pipes, make them failsafe.
These functions can no longer fail.
Diffstat (limited to 'src/sp/transport/udp')
| -rw-r--r-- | src/sp/transport/udp/udp.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/sp/transport/udp/udp.c b/src/sp/transport/udp/udp.c index 242ca481..7f46a3c9 100644 --- a/src/sp/transport/udp/udp.c +++ b/src/sp/transport/udp/udp.c @@ -261,6 +261,20 @@ udp_pipe_start(udp_pipe *p, udp_ep *ep, const nng_sockaddr *sa) return (udp_add_pipe(ep, p)); } +static const nng_sockaddr * +udp_pipe_peer_addr(void *arg) +{ + udp_pipe *p = arg; + return (&p->peer_addr); +} + +static const nng_sockaddr * +udp_pipe_self_addr(void *arg) +{ + udp_pipe *p = arg; + return (&p->ep->self_sa); +} + static void udp_pipe_fini(void *arg) { @@ -1693,15 +1707,17 @@ udp_pipe_size(void) } static nni_sp_pipe_ops udp_pipe_ops = { - .p_size = udp_pipe_size, - .p_init = udp_pipe_init, - .p_fini = udp_pipe_fini, - .p_stop = udp_pipe_stop, - .p_send = udp_pipe_send, - .p_recv = udp_pipe_recv, - .p_close = udp_pipe_close, - .p_peer = udp_pipe_peer, - .p_getopt = udp_pipe_getopt, + .p_size = udp_pipe_size, + .p_init = udp_pipe_init, + .p_fini = udp_pipe_fini, + .p_stop = udp_pipe_stop, + .p_send = udp_pipe_send, + .p_recv = udp_pipe_recv, + .p_close = udp_pipe_close, + .p_peer = udp_pipe_peer, + .p_getopt = udp_pipe_getopt, + .p_peer_addr = udp_pipe_peer_addr, + .p_self_addr = udp_pipe_self_addr, }; static const nni_option udp_ep_opts[] = { |
