aboutsummaryrefslogtreecommitdiff
path: root/src/sp/transport/ipc/ipc.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-04-21 12:23:07 -0700
committerGitHub <noreply@github.com>2024-04-21 12:23:07 -0700
commit56507ab5c4db009be5251bde832f594fe5ed3d5e (patch)
treec70e7d669c3548a5c58ab27c0fc6118a96580863 /src/sp/transport/ipc/ipc.c
parent3593eba5272bf627b99a2521b3f025141a49bcad (diff)
downloadnng-56507ab5c4db009be5251bde832f594fe5ed3d5e.tar.gz
nng-56507ab5c4db009be5251bde832f594fe5ed3d5e.tar.bz2
nng-56507ab5c4db009be5251bde832f594fe5ed3d5e.zip
Logging improvements (#1816)
* Add nng_str_sockaddr to get string representation of socket address. * Added nng_log_get_level() is meant to allow users to obtain the current level and avoid some possibly expensive operations just to collect debugging information when debugging is not in effect. We use a custom logger for NUTS, and this fits within the NUTS test framework well, so that if -v is supplied we get more content. All tests now get this by default.
Diffstat (limited to 'src/sp/transport/ipc/ipc.c')
-rw-r--r--src/sp/transport/ipc/ipc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/sp/transport/ipc/ipc.c b/src/sp/transport/ipc/ipc.c
index fc817d1a..61c25da3 100644
--- a/src/sp/transport/ipc/ipc.c
+++ b/src/sp/transport/ipc/ipc.c
@@ -382,9 +382,19 @@ ipc_pipe_recv_cb(void *arg)
// Make sure the message payload is not too big. If it is
// the caller will shut down the pipe.
if ((len > p->rcv_max) && (p->rcv_max > 0)) {
+ uint64_t pid;
+ char peer[64] = "";
+ if (nng_stream_get_uint64(
+ p->conn, NNG_OPT_PEER_PID, &pid) == 0) {
+ snprintf(peer, sizeof(peer), " from PID %lu",
+ (unsigned long) pid);
+ }
nng_log_warn("NNG-RCVMAX",
- "Rejected oversize message of %lu bytes on IPC",
- (unsigned long) len);
+ "Oversize message of %lu bytes (> %lu) "
+ "on socket<%u> pipe<%u> from IPC%s",
+ (unsigned long) len, (unsigned long) p->rcv_max,
+ nni_pipe_sock_id(p->pipe), nni_pipe_id(p->pipe),
+ peer);
rv = NNG_EMSGSIZE;
goto error;
}