aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-25 11:43:59 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-25 20:11:51 -0700
commitcc419cf01d9c060a3bd3fc318f9b9bc9e736dae9 (patch)
tree2f26cd782a54bed35e03b451003deee5df701983 /src/core/socket.c
parentebc479a61b8f2d2f3a6d846d18debfb9022e6010 (diff)
downloadnng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.tar.gz
nng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.tar.bz2
nng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.zip
Add stream direct address functions for socket addresses.
This is going to be used to facilitate debugging, and eliminate some inconveniences around these things. We plan to move the pipe functions to use these directly, hopefully moving away from the pipe_getopt hack. (The transport API will need to grow these. For now this is just the streams.)
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index 7112014e..a7633c9e 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1301,7 +1301,8 @@ dialer_start_pipe(nni_dialer *d, nni_pipe *p)
char addr[NNG_MAXADDRSTRLEN];
nng_log_debug("NNG-PIPEREJECT",
"Pipe on socket<%u> from %s rejected by callback",
- nni_pipe_sock_id(p), nni_pipe_peer_addr(p, addr));
+ nni_pipe_sock_id(p),
+ nni_pipe_peer_str_addr(p, addr));
}
nni_pipe_rele(p);
return;
@@ -1323,10 +1324,13 @@ dialer_start_pipe(nni_dialer *d, nni_pipe *p)
#endif
nni_pipe_run_cb(p, NNG_PIPE_EV_ADD_POST);
if (nng_log_get_level() >= NNG_LOG_DEBUG) {
- char addr[NNG_MAXADDRSTRLEN];
+ char peer_addr[NNG_MAXADDRSTRLEN];
+ char self_addr[NNG_MAXADDRSTRLEN];
nng_log_debug("NNG-CONNECT",
- "Connected pipe<%u> on socket<%u> to %s", nni_pipe_id(p),
- nni_sock_id(s), nni_pipe_peer_addr(p, addr));
+ "Connected pipe<%u> on socket<%u> at %s to %s",
+ nni_pipe_id(p), nni_sock_id(s),
+ nni_pipe_self_str_addr(p, self_addr),
+ nni_pipe_peer_str_addr(p, peer_addr));
}
nni_pipe_rele(p);
}
@@ -1429,10 +1433,13 @@ listener_start_pipe(nni_listener *l, nni_pipe *p)
#endif
nni_pipe_run_cb(p, NNG_PIPE_EV_ADD_POST);
if (nng_log_get_level() >= NNG_LOG_DEBUG) {
- char addr[NNG_MAXADDRSTRLEN];
+ char peer_addr[NNG_MAXADDRSTRLEN];
+ char self_addr[NNG_MAXADDRSTRLEN];
nng_log_debug("NNG-ACCEPT",
- "Accepted pipe<%u> on socket<%u> from %s", nni_pipe_id(p),
- nni_sock_id(s), nni_pipe_peer_addr(p, addr));
+ "Accepted pipe<%u> on socket<%u> at %s from %s",
+ nni_pipe_id(p), nni_sock_id(s),
+ nni_pipe_self_str_addr(p, self_addr),
+ nni_pipe_peer_str_addr(p, peer_addr));
}
// the socket now "owns" the pipe, and a pipe close should immediately