From 23a38d766780f4749945d84316b4e0a71e707b15 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 4 Mar 2018 17:04:11 -0800 Subject: fixes #262 NNG_OPT_URL should be resolved This causes TCP, TLS, and ZT endpoints to resolve any wildcards, and even IP addresses, when reporting the listen URL. The dialer URL is reported unresolved. Test cases for this are added as well, and nngcat actually reports this if --verbose is supplied. --- tools/nngcat/nngcat.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tools') diff --git a/tools/nngcat/nngcat.c b/tools/nngcat/nngcat.c index 064e4635..7459c319 100644 --- a/tools/nngcat/nngcat.c +++ b/tools/nngcat/nngcat.c @@ -1008,6 +1008,15 @@ main(int ac, const char **av) } rv = nng_dialer_start(d, async); act = "dial"; + if ((rv == 0) && (verbose == OPT_VERBOSE)) { + char ustr[256]; + size_t sz; + sz = sizeof(ustr); + if (nng_dialer_getopt( + d, NNG_OPT_URL, ustr, &sz) == 0) { + printf("Connected to: %s\n", ustr); + } + } break; case OPT_LISTEN: case OPT_LISTEN_IPC: @@ -1027,6 +1036,15 @@ main(int ac, const char **av) } rv = nng_listener_start(l, async); act = "listen"; + if ((rv == 0) && (verbose == OPT_VERBOSE)) { + char ustr[256]; + size_t sz; + sz = sizeof(ustr); + if (nng_listener_getopt( + l, NNG_OPT_URL, ustr, &sz) == 0) { + printf("Listening at: %s\n", ustr); + } + } break; default: fatal("Invalid address mode! (Bug!)"); -- cgit v1.2.3-70-g09d2