nxt_conn_accept.c (337:854a1a440616) nxt_conn_accept.c (338:2c6135a99c27)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 70 unchanged lines hidden (view full) ---

79
80 return NULL;
81}
82
83
84static nxt_conn_t *
85nxt_conn_accept_alloc(nxt_task_t *task, nxt_listen_event_t *lev)
86{
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 70 unchanged lines hidden (view full) ---

79
80 return NULL;
81}
82
83
84static nxt_conn_t *
85nxt_conn_accept_alloc(nxt_task_t *task, nxt_listen_event_t *lev)
86{
87 nxt_mp_t *mp;
88 nxt_conn_t *c;
89 nxt_event_engine_t *engine;
90 nxt_listen_socket_t *ls;
87 nxt_mp_t *mp;
88 nxt_conn_t *c;
89 nxt_event_engine_t *engine;
91
92 engine = task->thread->engine;
93
94 if (engine->connections < engine->max_connections) {
95
96 mp = nxt_mp_create(1024, 128, 256, 32);
97
98 if (nxt_fast_path(mp != NULL)) {
99 c = nxt_conn_create(mp, lev->socket.task);
100 if (nxt_slow_path(c == NULL)) {
101 goto fail;
102 }
103
104 lev->next = c;
105 c->socket.read_work_queue = lev->socket.read_work_queue;
106 c->socket.write_ready = 1;
107 c->listen = lev;
108
90
91 engine = task->thread->engine;
92
93 if (engine->connections < engine->max_connections) {
94
95 mp = nxt_mp_create(1024, 128, 256, 32);
96
97 if (nxt_fast_path(mp != NULL)) {
98 c = nxt_conn_create(mp, lev->socket.task);
99 if (nxt_slow_path(c == NULL)) {
100 goto fail;
101 }
102
103 lev->next = c;
104 c->socket.read_work_queue = lev->socket.read_work_queue;
105 c->socket.write_ready = 1;
106 c->listen = lev;
107
109 ls = lev->listen;
110
111 c->remote = nxt_sockaddr_cache_alloc(engine, lev);
112 if (nxt_fast_path(c->remote != NULL)) {
113 return c;
114 }
115 }
116
117 fail:
118

--- 248 unchanged lines hidden ---
108 c->remote = nxt_sockaddr_cache_alloc(engine, lev);
109 if (nxt_fast_path(c->remote != NULL)) {
110 return c;
111 }
112 }
113
114 fail:
115

--- 248 unchanged lines hidden ---