diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-04-21 12:23:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-21 12:23:07 -0700 |
| commit | 56507ab5c4db009be5251bde832f594fe5ed3d5e (patch) | |
| tree | c70e7d669c3548a5c58ab27c0fc6118a96580863 /src/sp/transport/tls | |
| parent | 3593eba5272bf627b99a2521b3f025141a49bcad (diff) | |
| download | nng-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/tls')
| -rw-r--r-- | src/sp/transport/tls/tls.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c index 4412fa03..30a95725 100644 --- a/src/sp/transport/tls/tls.c +++ b/src/sp/transport/tls/tls.c @@ -377,9 +377,20 @@ tlstran_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->rcvmax) && (p->rcvmax > 0)) { + nng_sockaddr_storage ss; + nng_sockaddr *sa = (nng_sockaddr *) &ss; + char peername[64] = "unknown"; + if ((rv = nng_stream_get_addr( + p->tls, NNG_OPT_REMADDR, sa)) == 0) { + (void) nng_str_sockaddr( + sa, peername, sizeof(peername)); + } nng_log_warn("NNG-RCVMAX", - "Rejected oversize message of %lu bytes on TLS", - (unsigned long) len); + "Oversize message of %lu bytes (> %lu) " + "on socket<%u> pipe<%u> from TLS %s", + (unsigned long) len, (unsigned long) p->rcvmax, + nni_pipe_sock_id(p->npipe), nni_pipe_id(p->npipe), + peername); rv = NNG_EMSGSIZE; goto recv_error; } |
