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/websocket/websocket_test.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/supplemental/websocket/websocket_test.c') diff --git a/src/supplemental/websocket/websocket_test.c b/src/supplemental/websocket/websocket_test.c index cb502ef4..66c9617e 100644 --- a/src/supplemental/websocket/websocket_test.c +++ b/src/supplemental/websocket/websocket_test.c @@ -131,6 +131,8 @@ test_websocket_conn_props(void) nng_stream_listener *l = NULL; nng_sockaddr sa1; nng_sockaddr sa2; + const nng_sockaddr *sap1; + const nng_sockaddr *sap2; size_t sz; nng_aio *daio = NULL; nng_aio *laio = NULL; @@ -182,11 +184,15 @@ test_websocket_conn_props(void) NUTS_TRUE(c2 != NULL); // Let's compare the peer addresses + NUTS_PASS(nng_stream_self_addr(c1, &sap1)); + NUTS_PASS(nng_stream_peer_addr(c2, &sap2)); NUTS_PASS(nng_stream_get_addr(c1, NNG_OPT_LOCADDR, &sa1)); NUTS_PASS(nng_stream_get_addr(c2, NNG_OPT_REMADDR, &sa2)); NUTS_TRUE(sa1.s_family == sa2.s_family); NUTS_TRUE(sa1.s_in.sa_addr == sa2.s_in.sa_addr); NUTS_TRUE(sa1.s_in.sa_port == sa2.s_in.sa_port); + NUTS_TRUE(memcmp(sap1, &sa1, sizeof(sa1)) == 0); + NUTS_TRUE(memcmp(sap2, &sa2, sizeof(sa2)) == 0); NUTS_PASS(nng_stream_get_addr(c1, NNG_OPT_REMADDR, &sa1)); NUTS_PASS(nng_stream_get_addr(c2, NNG_OPT_LOCADDR, &sa2)); -- cgit v1.2.3-70-g09d2