nxt_conn_accept.c (493:745222d540a2) nxt_conn_accept.c (564:762f8c976ead)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

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

229 c = nxt_conn_accept_alloc(task, lev);
230
231 if (nxt_fast_path(c != NULL)) {
232 return c;
233 }
234
235 } while (nxt_conn_accept_close_idle(task, lev) == NXT_OK);
236
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

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

229 c = nxt_conn_accept_alloc(task, lev);
230
231 if (nxt_fast_path(c != NULL)) {
232 return c;
233 }
234
235 } while (nxt_conn_accept_close_idle(task, lev) == NXT_OK);
236
237 nxt_log(task, NXT_LOG_CRIT, "no available connections, "
238 "new connections are not accepted within 1s");
237 nxt_alert(task, "no available connections, "
238 "new connections are not accepted within 1s");
239
240 return NULL;
241}
242
243
244static nxt_int_t
245nxt_conn_accept_close_idle(nxt_task_t *task, nxt_listen_event_t *lev)
246{

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

304 accept_syscall, lev->socket.fd, err);
305 return;
306
307 case EMFILE:
308 case ENFILE:
309 case ENOBUFS:
310 case ENOMEM:
311 if (nxt_conn_accept_close_idle(task, lev) != NXT_OK) {
239
240 return NULL;
241}
242
243
244static nxt_int_t
245nxt_conn_accept_close_idle(nxt_task_t *task, nxt_listen_event_t *lev)
246{

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

304 accept_syscall, lev->socket.fd, err);
305 return;
306
307 case EMFILE:
308 case ENFILE:
309 case ENOBUFS:
310 case ENOMEM:
311 if (nxt_conn_accept_close_idle(task, lev) != NXT_OK) {
312 nxt_log(task, NXT_LOG_CRIT, "%s(%d) failed %E, "
313 "new connections are not accepted within 1s",
314 accept_syscall, lev->socket.fd, err);
312 nxt_alert(task, "%s(%d) failed %E, "
313 "new connections are not accepted within 1s",
314 accept_syscall, lev->socket.fd, err);
315 }
316
317 return;
318
319 default:
315 }
316
317 return;
318
319 default:
320 nxt_log(task, NXT_LOG_CRIT, "%s(%d) failed %E",
321 accept_syscall, lev->socket.fd, err);
320 nxt_alert(task, "%s(%d) failed %E",
321 accept_syscall, lev->socket.fd, err);
322 return;
323 }
324}
325
326
327static void
328nxt_conn_listen_timer_handler(nxt_task_t *task, void *obj, void *data)
329{

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

352
353static void
354nxt_conn_listen_event_error(nxt_task_t *task, void *obj, void *data)
355{
356 nxt_fd_event_t *ev;
357
358 ev = obj;
359
322 return;
323 }
324}
325
326
327static void
328nxt_conn_listen_timer_handler(nxt_task_t *task, void *obj, void *data)
329{

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

352
353static void
354nxt_conn_listen_event_error(nxt_task_t *task, void *obj, void *data)
355{
356 nxt_fd_event_t *ev;
357
358 ev = obj;
359
360 nxt_log(task, NXT_LOG_CRIT, "accept(%d) event error", ev->fd);
360 nxt_alert(task, "accept(%d) event error", ev->fd);
361}
361}