diff options
| author | Mike Bush <mike.bush@allenvanguard.com> | 2018-07-24 09:02:13 -0400 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-07-24 07:55:04 -0700 |
| commit | 9b9526e4a643d36d9c66f2254f00df7298e5562f (patch) | |
| tree | 670c64ee70451bbc22ea6e3f8bdcf49dc38d8815 /src/platform/windows | |
| parent | 0a746ae40b4a06e278f9f11db9e00d09ed4df868 (diff) | |
| download | nng-9b9526e4a643d36d9c66f2254f00df7298e5562f.tar.gz nng-9b9526e4a643d36d9c66f2254f00df7298e5562f.tar.bz2 nng-9b9526e4a643d36d9c66f2254f00df7298e5562f.zip | |
Modified code to explicitly set hints.ai_socktype passed to getaddrinfo(). On QNX, specifying a numeric servname while leaving ai_socktype unspecified would result in EAI_SERVICE.
Diffstat (limited to 'src/platform/windows')
| -rw-r--r-- | src/platform/windows/win_resolv.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/platform/windows/win_resolv.c b/src/platform/windows/win_resolv.c index 916f54b1..cc876d04 100644 --- a/src/platform/windows/win_resolv.c +++ b/src/platform/windows/win_resolv.c @@ -38,6 +38,7 @@ struct resolv_item { int passive; const char * name; int proto; + int socktype; uint16_t port; nni_aio * aio; nng_sockaddr sa; @@ -115,6 +116,7 @@ resolv_task(resolv_item *item) } hints.ai_protocol = item->proto; hints.ai_family = item->family; + hints.ai_socktype = item->socktype; if ((rv = getaddrinfo(item->name, "80", &hints, &results)) != 0) { rv = resolv_errno(rv); @@ -165,7 +167,7 @@ done: static void resolv_ip(const char *host, const char *serv, int passive, int family, - int proto, nni_aio *aio) + int proto, int socktype, nni_aio *aio) { resolv_item *item; int fam; @@ -222,12 +224,13 @@ resolv_ip(const char *host, const char *serv, int passive, int family, return; } memset(&item->sa, 0, sizeof(item->sa)); - item->passive = passive; - item->name = host; - item->proto = proto; - item->aio = aio; - item->family = fam; - item->port = htons((uint16_t) port); + item->passive = passive; + item->name = host; + item->proto = proto; + item->aio = aio; + item->family = fam; + item->socktype = socktype; + item->port = htons((uint16_t) port); nni_mtx_lock(&resolv_mtx); if (resolv_fini) { @@ -250,14 +253,14 @@ void nni_tcp_resolv( const char *host, const char *serv, int family, int passive, nni_aio *aio) { - resolv_ip(host, serv, passive, family, IPPROTO_TCP, aio); + resolv_ip(host, serv, passive, family, IPPROTO_TCP, SOCK_STREAM, aio); } void nni_udp_resolv( const char *host, const char *serv, int family, int passive, nni_aio *aio) { - resolv_ip(host, serv, passive, family, IPPROTO_UDP, aio); + resolv_ip(host, serv, passive, family, IPPROTO_UDP, SOCK_DGRAM, aio); } void |
