From cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 25 Oct 2025 11:43:59 -0700 Subject: 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.) --- src/supplemental/http/http_conn.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/supplemental/http/http_conn.c') diff --git a/src/supplemental/http/http_conn.c b/src/supplemental/http/http_conn.c index ac549649..bb3a0882 100644 --- a/src/supplemental/http/http_conn.c +++ b/src/supplemental/http/http_conn.c @@ -22,6 +22,7 @@ #include "http_api.h" #include "http_msg.h" +#include "nng/nng.h" // We insist that individual headers fit in 8K. // If you need more than that, you need something we can't do. @@ -160,13 +161,15 @@ nni_http_conn_close(nni_http_conn *conn) } nng_err -nni_http_get_addr(nni_http_conn *conn, const char *opt, nng_sockaddr *addrp) +nni_http_peer_addr(nni_http_conn *conn, const nng_sockaddr **sap) { - nng_err rv; - nni_mtx_lock(&conn->mtx); - rv = nng_stream_get_addr(conn->sock, opt, addrp); - nni_mtx_unlock(&conn->mtx); - return (rv); + return nng_stream_peer_addr(conn->sock, sap); +} + +nng_err +nni_http_self_addr(nni_http_conn *conn, const nng_sockaddr **sap) +{ + return nng_stream_self_addr(conn->sock, sap); } // http_buf_pull_up pulls the content of the read buffer back to the -- cgit v1.2.3-70-g09d2