diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-10-26 10:54:58 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-10-27 07:13:40 -0700 |
| commit | be13c2e8845423cec17af429fc4e16a5d9749e47 (patch) | |
| tree | 82614e403a41aac6581a9a223ef9eba5be557222 /src/sp/transport/tls/tls.c | |
| parent | 11c53f3d7f747d14fd69ce98c63d629bc821ef68 (diff) | |
| download | nng-be13c2e8845423cec17af429fc4e16a5d9749e47.tar.gz nng-be13c2e8845423cec17af429fc4e16a5d9749e47.tar.bz2 nng-be13c2e8845423cec17af429fc4e16a5d9749e47.zip | |
Replace nng_pipe_get_addr, nng_stream_get_addr, and the NNG_OPT_REMADDR option.
More direct access methods are provided instead.
This results in much lower friction when using, and is a step on the path
to removing NNG_OPT_LOCADDR as well.
We need to figure a solution for NNG_OPT_LOCADDR for dialers; for
listeners there is little use in it either, and it will be removed.
(Dialers will probably get a new NNG_OPT_BIND_IP option.)
Diffstat (limited to 'src/sp/transport/tls/tls.c')
| -rw-r--r-- | src/sp/transport/tls/tls.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c index 5086a942..a4e35b36 100644 --- a/src/sp/transport/tls/tls.c +++ b/src/sp/transport/tls/tls.c @@ -13,6 +13,7 @@ #include <string.h> #include "../../../core/nng_impl.h" +#include "nng/nng.h" // TLS over TCP transport. Platform specific TCP operations must be // supplied as well, and uses the supplemental TLS v1.2 code. It is not @@ -343,20 +344,15 @@ 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)); - } + char peer[NNG_MAXADDRSTRLEN]; + nng_log_warn("NNG-RCVMAX", "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); + nng_str_sockaddr(nng_stream_peer_addr(p->tls), + peer, sizeof(peer))); rv = NNG_EMSGSIZE; goto recv_error; } |
