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. --- src/core/endpt.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/core/endpt.c') diff --git a/src/core/endpt.c b/src/core/endpt.c index 4d3727bc..4d3d9031 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -618,10 +618,6 @@ nni_ep_getopt(nni_ep *ep, const char *name, void *valp, size_t *szp) { nni_tran_ep_option *eo; - if (strcmp(name, NNG_OPT_URL) == 0) { - return (nni_getopt_str(ep->ep_url->u_rawurl, valp, szp)); - } - for (eo = ep->ep_ops.ep_options; eo && eo->eo_name; eo++) { int rv; if (strcmp(eo->eo_name, name) != 0) { @@ -636,6 +632,13 @@ nni_ep_getopt(nni_ep *ep, const char *name, void *valp, size_t *szp) return (rv); } + // We provide a fallback on the URL, but let the implementation + // override. This allows the URL to be created with wildcards, + // that are resolved later. + if (strcmp(name, NNG_OPT_URL) == 0) { + return (nni_getopt_str(ep->ep_url->u_rawurl, valp, szp)); + } + return (nni_sock_getopt(ep->ep_sock, name, valp, szp)); } -- cgit v1.2.3-70-g09d2