diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-06 09:11:13 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-06 17:38:28 -0800 |
| commit | eec083d60d972c3fad47b195e4f00691ace65689 (patch) | |
| tree | 91f7ee59c553c2e4f2ebd575e4fe646306f54088 /src | |
| parent | 397b5006b76fe6390a48db4a753857a6f2e4d173 (diff) | |
| download | nng-eec083d60d972c3fad47b195e4f00691ace65689.tar.gz nng-eec083d60d972c3fad47b195e4f00691ace65689.tar.bz2 nng-eec083d60d972c3fad47b195e4f00691ace65689.zip | |
url: add nng_url_resolve_port
This API exists to support tests and similar cases where port 0 is
used to choose a dynamic port. Once the port is bound, and an actual
value is known, it can be patched in using this API.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/url.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/url.c b/src/core/url.c index 530e299c..1b39f809 100644 --- a/src/core/url.c +++ b/src/core/url.c @@ -719,6 +719,14 @@ nng_url_port(const nng_url *url) return (url->u_port); } +void +nng_url_resolve_port(nng_url *url, uint32_t port) +{ + if (url->u_port == 0) { + url->u_port = port; + } +} + const char * nng_url_hostname(const nng_url *url) { |
