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/socket | |
| 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/socket')
| -rw-r--r-- | src/sp/transport/socket/sockfd.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/sp/transport/socket/sockfd.c b/src/sp/transport/socket/sockfd.c index 57693088..8f03fad3 100644 --- a/src/sp/transport/socket/sockfd.c +++ b/src/sp/transport/socket/sockfd.c @@ -115,6 +115,20 @@ sfd_tran_pipe_stop(void *arg) nni_mtx_unlock(&ep->mtx); } +static const nng_sockaddr * +sfd_tran_pipe_peer_addr(void *arg) +{ + sfd_tran_pipe *p = arg; + return (nng_stream_peer_addr(p->conn)); +} + +static const nng_sockaddr * +sfd_tran_pipe_self_addr(void *arg) +{ + sfd_tran_pipe *p = arg; + return (nng_stream_self_addr(p->conn)); +} + static int sfd_tran_pipe_init(void *arg, nni_pipe *npipe) { @@ -814,15 +828,18 @@ sfd_tran_pipe_size(void) } static nni_sp_pipe_ops sfd_tran_pipe_ops = { - .p_size = sfd_tran_pipe_size, - .p_init = sfd_tran_pipe_init, - .p_fini = sfd_tran_pipe_fini, - .p_stop = sfd_tran_pipe_stop, - .p_send = sfd_tran_pipe_send, - .p_recv = sfd_tran_pipe_recv, - .p_close = sfd_tran_pipe_close, - .p_peer = sfd_tran_pipe_peer, - .p_getopt = sfd_tran_pipe_getopt, + .p_size = sfd_tran_pipe_size, + .p_init = sfd_tran_pipe_init, + .p_fini = sfd_tran_pipe_fini, + .p_stop = sfd_tran_pipe_stop, + .p_send = sfd_tran_pipe_send, + .p_recv = sfd_tran_pipe_recv, + .p_close = sfd_tran_pipe_close, + .p_peer = sfd_tran_pipe_peer, + .p_getopt = sfd_tran_pipe_getopt, + .p_peer_addr = sfd_tran_pipe_peer_addr, + .p_self_addr = sfd_tran_pipe_self_addr, + }; static const nni_option sfd_tran_ep_opts[] = { |
