diff options
| -rw-r--r-- | include/nng/nng.h | 5 | ||||
| -rw-r--r-- | src/core/platform.h | 2 | ||||
| -rw-r--r-- | src/core/url.c | 2 | ||||
| -rw-r--r-- | src/core/url.h | 2 | ||||
| -rw-r--r-- | src/platform/posix/posix_resolv_gai.c | 2 | ||||
| -rw-r--r-- | src/platform/resolver_test.c | 2 | ||||
| -rw-r--r-- | src/platform/windows/win_resolv.c | 2 | ||||
| -rw-r--r-- | src/supplemental/http/http_server.c | 6 |
8 files changed, 13 insertions, 10 deletions
diff --git a/include/nng/nng.h b/include/nng/nng.h index 8b56d15a..f6b0a179 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -1103,8 +1103,9 @@ NNG_DECL int nng_url_sprintf(char *, size_t, const nng_url *); NNG_DECL const char *nng_url_scheme(const nng_url *); -// Port (TCP) for a URL, can be zero for ports are not used by the scheme. -NNG_DECL uint16_t nng_url_port(const nng_url *); +// Port (such as UDP or TCP) for a URL, can be zero for ports are not used by +// the scheme. +NNG_DECL uint32_t nng_url_port(const nng_url *); // hostname part of URL, can be NULL if irerelvant to scheme const char *nng_url_hostname(const nng_url *); diff --git a/src/core/platform.h b/src/core/platform.h index 783cc9fc..0249e2a0 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -353,7 +353,7 @@ extern int nni_parse_ip_port(const char *, nng_sockaddr *); // nni_get_port_by_name resolves a name (which may be an ASCII representation // of a number) to a port number (the value returned is in native byte order.) -extern int nni_get_port_by_name(const char *, uint16_t *); +extern int nni_get_port_by_name(const char *, uint32_t *); // // IPC (UNIX Domain Sockets & Named Pipes) Support. diff --git a/src/core/url.c b/src/core/url.c index 7af6a822..e436b0e1 100644 --- a/src/core/url.c +++ b/src/core/url.c @@ -697,7 +697,7 @@ nng_url_scheme(const nng_url *url) return (url->u_scheme); } -uint16_t +uint32_t nng_url_port(const nng_url *url) { return (url->u_port); diff --git a/src/core/url.h b/src/core/url.h index 0f5f33c9..5aa53dfd 100644 --- a/src/core/url.h +++ b/src/core/url.h @@ -18,7 +18,7 @@ struct nng_url { const char *u_scheme; // never NULL const char *u_userinfo; // will be NULL if not specified char *u_hostname; // name only, will be "" if not specified - uint16_t u_port; // port, may be zero for schemes that do not use + uint32_t u_port; // port, may be zero for schemes that do not use char *u_path; // path, will be "" if not specified char *u_query; // without '?', will be NULL if not specified char *u_fragment; // without '#', will be NULL if not specified diff --git a/src/platform/posix/posix_resolv_gai.c b/src/platform/posix/posix_resolv_gai.c index c26657e9..66d7b35b 100644 --- a/src/platform/posix/posix_resolv_gai.c +++ b/src/platform/posix/posix_resolv_gai.c @@ -460,7 +460,7 @@ nni_parse_ip_port(const char *addr, nni_sockaddr *sa) } int -nni_get_port_by_name(const char *name, uint16_t *portp) +nni_get_port_by_name(const char *name, uint32_t *portp) { struct servent *se; long port; diff --git a/src/platform/resolver_test.c b/src/platform/resolver_test.c index 9c7db2c0..005affe3 100644 --- a/src/platform/resolver_test.c +++ b/src/platform/resolver_test.c @@ -111,7 +111,7 @@ test_service_names(void) { nng_aio *aio; nng_sockaddr sa; - uint16_t port; + uint32_t port; NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nni_resolv_ip("8.8.4.4", 80, NNG_AF_INET, true, &sa, aio); diff --git a/src/platform/windows/win_resolv.c b/src/platform/windows/win_resolv.c index f9e5e1f6..46695b7e 100644 --- a/src/platform/windows/win_resolv.c +++ b/src/platform/windows/win_resolv.c @@ -412,7 +412,7 @@ nni_parse_ip_port(const char *addr, nni_sockaddr *sa) } int -nni_get_port_by_name(const char *name, uint16_t *portp) +nni_get_port_by_name(const char *name, uint32_t *portp) { struct servent *se; long port; diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c index 0f0d2d80..72e7fa72 100644 --- a/src/supplemental/http/http_server.c +++ b/src/supplemental/http/http_server.c @@ -77,7 +77,7 @@ struct nng_http_server { bool fini; // if nni_http_server_fini was called nni_aio *accaio; nng_stream_listener *listener; - int port; // native order + uint32_t port; // native order char *hostname; nni_list errors; nni_mtx errors_mtx; @@ -1014,8 +1014,10 @@ http_server_start(nni_http_server *s) return (rv); } if (s->port == 0) { + int port; nng_stream_listener_get_int( - s->listener, NNG_OPT_TCP_BOUND_PORT, &s->port); + s->listener, NNG_OPT_TCP_BOUND_PORT, &port); + s->port = (uint32_t) port; } nng_stream_listener_accept(s->listener, s->accaio); return (0); |
