diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-10-17 16:22:38 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-10-17 16:22:38 +0300 |
commit | 09ef66d39c277ed709e2333f992b1d87304bf663 (patch) | |
tree | 980e60508cb4c86b2a6637616001d10eaeb8f393 /src/nxt_sockaddr.h | |
parent | 1c6d4d8cff1f9c2da56ce6cc433c17b2d69fca2b (diff) | |
download | unit-09ef66d39c277ed709e2333f992b1d87304bf663.tar.gz unit-09ef66d39c277ed709e2333f992b1d87304bf663.tar.bz2 |
Storing memory cache slot hint inside nxt_sockaddr_t.
Diffstat (limited to 'src/nxt_sockaddr.h')
-rw-r--r-- | src/nxt_sockaddr.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nxt_sockaddr.h b/src/nxt_sockaddr.h index 6f2c4a77..ca5d8054 100644 --- a/src/nxt_sockaddr.h +++ b/src/nxt_sockaddr.h @@ -41,11 +41,9 @@ struct nxt_sockaddr_s { * Port length is (start + length) - port_start. */ uint8_t port_start; - /* - * Size of the whole structure: struct sockaddr union and maximal textual - * representation, used to place sockaddr into appropriate free list. - */ - uint8_t sockaddr_size; + + /* A cache hist used to place sockaddr into appropriate free list. */ + uint8_t cache_hint; union { struct sockaddr sockaddr; @@ -70,7 +68,7 @@ typedef struct { nxt_sockaddr_t *nxt_sockaddr_cache_alloc(nxt_event_engine_t *engine, - nxt_listen_event_t *lev); + nxt_listen_socket_t *ls); void nxt_sockaddr_cache_free(nxt_event_engine_t *engine, nxt_conn_t *c); NXT_EXPORT nxt_sockaddr_t *nxt_sockaddr_alloc(nxt_mp_t *mp, socklen_t socklen, @@ -107,6 +105,8 @@ NXT_EXPORT nxt_int_t nxt_inet6_addr(struct in6_addr *in6_addr, u_char *buf, (sizeof("[ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535") - 1) +#define nxt_sockaddr_size(sa) \ + (offsetof(nxt_sockaddr_t, u) + sa->socklen + sa->length) #define nxt_sockaddr_start(sa) nxt_pointer_to(sa, (sa)->start) #define nxt_sockaddr_address(sa) nxt_pointer_to(sa, (sa)->address_start) #define nxt_sockaddr_port(sa) nxt_pointer_to(sa, (sa)->port_start) |