summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_router.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-09-27 19:22:59 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-09-27 19:22:59 +0300
commitbfa808d68997d74bfe0d54196bbbb649646787c1 (patch)
tree16751ca3da7dfd1c3c7830b3203fffdaea55b0cf /src/nxt_router.c
parent752038eea857988045ce72252e0d1c19509981b3 (diff)
downloadunit-bfa808d68997d74bfe0d54196bbbb649646787c1.tar.gz
unit-bfa808d68997d74bfe0d54196bbbb649646787c1.tar.bz2
Event engine memory cache for nxt_sockaddr_t.
Introducing event engine memory cache and using the cache for nxt_sockaddr_t structures.
Diffstat (limited to '')
-rw-r--r--src/nxt_router.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index d3c60a94..285c19b6 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -1819,6 +1819,9 @@ nxt_router_thread_start(void *data)
#endif
engine->mem_pool = nxt_mp_create(4096, 128, 1024, 64);
+ if (nxt_slow_path(engine->mem_pool == NULL)) {
+ return;
+ }
port = nxt_port_new(task, nxt_port_get_next_id(), nxt_pid,
NXT_PROCESS_ROUTER);
@@ -3433,6 +3436,7 @@ static void
nxt_router_conn_free(nxt_task_t *task, void *obj, void *data)
{
nxt_conn_t *c;
+ nxt_event_engine_t *engine;
nxt_req_conn_link_t *rc;
nxt_app_parse_ctx_t *ap;
nxt_socket_conf_joint_t *joint;
@@ -3466,11 +3470,14 @@ nxt_router_conn_free(nxt_task_t *task, void *obj, void *data)
nxt_queue_remove(&c->link);
- joint = c->listen->socket.data;
+ engine = task->thread->engine;
- task = &task->thread->engine->task;
+ nxt_sockaddr_cache_free(engine, c);
+
+ joint = c->listen->socket.data;
- nxt_mp_cleanup(c->mem_pool, nxt_router_conn_mp_cleanup, task, joint, NULL);
+ nxt_mp_cleanup(c->mem_pool, nxt_router_conn_mp_cleanup,
+ &engine->task, joint, NULL);
nxt_mp_release(c->mem_pool, c);
}