diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2022-08-03 14:42:49 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-08-11 18:43:12 +0200 |
commit | 22c510066686d4f5c8cecfeb54c0b958b5f5bb3f (patch) | |
tree | cb55e57c474540e8ce65aa94b35027b5ac1c8e95 /src/nxt_job_resolve.c | |
parent | 900828cc4b92e95b4810c00df9759ab9a07429c7 (diff) | |
download | unit-22c510066686d4f5c8cecfeb54c0b958b5f5bb3f.tar.gz unit-22c510066686d4f5c8cecfeb54c0b958b5f5bb3f.tar.bz2 |
Removed dead code.
nxt_sockaddr_ntop() stopped being used in commit (git) 029942f4eb71.
It has been replaced mostly by nxt_sockaddr_text().
commit 029942f4eb7196c2cff0d0e26bc6ff274138f7d8
Author: Igor Sysoev <igor@sysoev.ru>
Date: Wed Feb 22 15:09:59 2017 +0300
I/O operations refactoring.
nxt_job_sockaddr_parse() stopped being used in commit (git) 794248090a74.
commit 794248090a74f31cbfcf24ea8c835df2d4d21073
Author: Igor Sysoev <igor@sysoev.ru>
Date: Wed Mar 4 14:04:08 2020 +0300
Legacy upstream code removed.
Also, remove functions and types used only by those two functions:
nxt_job_sockaddr_unix_parse()
nxt_job_sockaddr_inet6_parse()
nxt_job_sockaddr_inet_parse()
nxt_job_sockaddr_parse_t
nxt_job_resolve()
nxt_job_resolve_t
Diffstat (limited to 'src/nxt_job_resolve.c')
-rw-r--r-- | src/nxt_job_resolve.c | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/src/nxt_job_resolve.c b/src/nxt_job_resolve.c deleted file mode 100644 index 0f1fb9aa..00000000 --- a/src/nxt_job_resolve.c +++ /dev/null @@ -1,132 +0,0 @@ - -/* - * Copyright (C) Igor Sysoev - * Copyright (C) NGINX, Inc. - */ - -#include <nxt_main.h> - - -void -nxt_job_resolve(nxt_job_resolve_t *jbr) -{ - int err; - u_char *host; - size_t length; - nxt_mp_t *mp; - nxt_uint_t n; - nxt_sockaddr_t *sa; - struct addrinfo hint, *res, *r; - nxt_work_handler_t handler; - - #define NXT_BUFSIZE 64 - u_char buf[NXT_BUFSIZE]; - - handler = jbr->error_handler; - res = NULL; - - length = jbr->name.length + 1; - - if (nxt_fast_path(length <= NXT_BUFSIZE)) { - host = buf; - - } else { - host = nxt_mp_alloc(jbr->job.mem_pool, length); - if (nxt_slow_path(host == NULL)) { - goto fail; - } - } - - nxt_cpystrn(host, jbr->name.start, length); - - nxt_memzero(&hint, sizeof(struct addrinfo)); - hint.ai_socktype = SOCK_STREAM; - - err = getaddrinfo((char *) host, NULL, &hint, &res); - - if (err != 0) { - nxt_thread_log_error(jbr->log_level, - "getaddrinfo(\"%s\") failed (%d: %s)", - host, err, gai_strerror(err)); - goto fail; - } - - n = 0; - for (r = res; r != NULL; r = r->ai_next) { - - switch (r->ai_addr->sa_family) { -#if (NXT_INET6) - case AF_INET6: -#endif - case AF_INET: - n++; - break; - - default: - break; - } - } - - jbr->count = n; - mp = jbr->job.mem_pool; - - jbr->sockaddrs = nxt_mp_alloc(mp, n * sizeof(nxt_sockaddr_t *)); - if (nxt_slow_path(jbr->sockaddrs == NULL)) { - goto fail; - } - - n = 0; - for (r = res; r != NULL; r = r->ai_next) { - - switch (r->ai_addr->sa_family) { -#if (NXT_INET6) - case AF_INET6: - length = NXT_INET6_ADDR_STR_LEN; - break; -#endif - case AF_INET: - length = NXT_INET_ADDR_STR_LEN; - break; - - default: - continue; - } - - sa = nxt_sockaddr_create(mp, r->ai_addr, r->ai_addrlen, length); - if (nxt_slow_path(sa == NULL)) { - goto fail; - } - - jbr->sockaddrs[n++] = sa; - - if (jbr->port != 0) { - - switch (sa->u.sockaddr.sa_family) { - case AF_INET: - sa->u.sockaddr_in.sin_port = jbr->port; - break; -#if (NXT_INET6) - case AF_INET6: - sa->u.sockaddr_in6.sin6_port = jbr->port; - break; -#endif - default: - break; - } - } - } - - handler = jbr->ready_handler; - -fail: - - if (nxt_fast_path(res != NULL)) { - freeaddrinfo(res); - } - - if (host != buf) { - nxt_mp_free(jbr->job.mem_pool, host); - } - - nxt_job_return(jbr->job.task, &jbr->job, handler); -} |