diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-03-04 17:04:11 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-03-04 19:42:17 -0800 |
| commit | 23a38d766780f4749945d84316b4e0a71e707b15 (patch) | |
| tree | 336cf1bfc7c7e32999653a4c4014232d2b735a3e /src/core/endpt.c | |
| parent | 0094f83a9e3b54d6cbfc1ea1885036366b87b991 (diff) | |
| download | nng-23a38d766780f4749945d84316b4e0a71e707b15.tar.gz nng-23a38d766780f4749945d84316b4e0a71e707b15.tar.bz2 nng-23a38d766780f4749945d84316b4e0a71e707b15.zip | |
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.
Diffstat (limited to 'src/core/endpt.c')
| -rw-r--r-- | src/core/endpt.c | 11 |
1 files changed, 7 insertions, 4 deletions
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)); } |
