From be13c2e8845423cec17af429fc4e16a5d9749e47 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 26 Oct 2025 10:54:58 -0700 Subject: 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.) --- src/sp/pipe_test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/sp/pipe_test.c') diff --git a/src/sp/pipe_test.c b/src/sp/pipe_test.c index 8f668d8c..532b6219 100644 --- a/src/sp/pipe_test.c +++ b/src/sp/pipe_test.c @@ -265,9 +265,22 @@ test_pipe_reject(void) fini_cases(&push, &pull); } +static void +test_pipe_invalid(void) +{ + nng_pipe p; + nng_sockaddr sa; + p.id = 45; // a random invalid pipe + + NUTS_FAIL(nng_pipe_peer_addr(p, &sa), NNG_ENOENT); + NUTS_FAIL(nng_pipe_self_addr(p, &sa), NNG_ENOENT); + NUTS_FAIL(nng_pipe_close(p), NNG_ENOENT); +} + NUTS_TESTS = { { "pipe msg id", test_pipe_msg_id }, { "pipe reconnect", test_pipe_reconnect }, { "pipe reject", test_pipe_reject }, + { "pipe invalid", test_pipe_invalid }, { NULL, NULL }, }; -- cgit v1.2.3-70-g09d2