diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-17 18:23:17 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-17 22:05:20 -0800 |
| commit | 85aff44e00e836eda618d4f1cf013bce38b3fd44 (patch) | |
| tree | 94b2dca800d6d254baae17932a017e031c17ce67 /src/sp/transport | |
| parent | ef82d4792bf59b1fe8053d9bb5ac924b443d8a78 (diff) | |
| download | nng-85aff44e00e836eda618d4f1cf013bce38b3fd44.tar.gz nng-85aff44e00e836eda618d4f1cf013bce38b3fd44.tar.bz2 nng-85aff44e00e836eda618d4f1cf013bce38b3fd44.zip | |
URL u_port should be a number not a string.
The idea here is to reduce the dynamic allocations used for
URLs, and also the back and forth with parsing begin strings
and port numbers. We always resolve to a port number, and
this is easier for everyone.
The real goal in the long term is to eliminate dynamic allocation
of the URL fields altogether, but that requires a little more
work. This is a step in the right direction.
Diffstat (limited to 'src/sp/transport')
| -rw-r--r-- | src/sp/transport/tcp/tcp.c | 2 | ||||
| -rw-r--r-- | src/sp/transport/tls/tls.c | 2 | ||||
| -rw-r--r-- | src/sp/transport/udp/udp.c | 3 |
3 files changed, 3 insertions, 4 deletions
diff --git a/src/sp/transport/tcp/tcp.c b/src/sp/transport/tcp/tcp.c index 54d31726..86d0ac07 100644 --- a/src/sp/transport/tcp/tcp.c +++ b/src/sp/transport/tcp/tcp.c @@ -874,7 +874,7 @@ tcptran_dialer_init(void **dp, nng_url *url, nni_dialer *ndialer) } if ((url->u_fragment != NULL) || (url->u_userinfo != NULL) || (url->u_query != NULL) || (strlen(url->u_hostname) == 0) || - (strlen(url->u_port) == 0)) { + (url->u_port == 0)) { return (NNG_EADDRINVAL); } diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c index 7a1d5582..b1aea7b3 100644 --- a/src/sp/transport/tls/tls.c +++ b/src/sp/transport/tls/tls.c @@ -837,7 +837,7 @@ tlstran_ep_init_dialer(void **dp, nni_url *url, nni_dialer *ndialer) } if ((url->u_fragment != NULL) || (url->u_userinfo != NULL) || (url->u_query != NULL) || (strlen(url->u_hostname) == 0) || - (strlen(url->u_port) == 0)) { + (url->u_port == 0)) { return (NNG_EADDRINVAL); } diff --git a/src/sp/transport/udp/udp.c b/src/sp/transport/udp/udp.c index 25899070..29a516d8 100644 --- a/src/sp/transport/udp/udp.c +++ b/src/sp/transport/udp/udp.c @@ -1443,8 +1443,7 @@ udp_check_url(nng_url *url, bool listen) return (NNG_EADDRINVAL); } if (!listen) { - if ((strlen(url->u_hostname) == 0) || - (strlen(url->u_port) == 0) || (atoi(url->u_port) == 0)) { + if ((strlen(url->u_hostname) == 0) || (url->u_port == 0)) { return (NNG_EADDRINVAL); } } |
