Lines Matching refs:c

22 static ssize_t nxt_http_idle_io_read_handler(nxt_task_t *task, nxt_conn_t *c);
25 static ssize_t nxt_h1p_idle_io_read_handler(nxt_task_t *task, nxt_conn_t *c);
33 nxt_h1proto_t *h1p, nxt_conn_t *c, nxt_socket_conf_t *skcf);
70 static nxt_msec_t nxt_h1p_conn_timer_value(nxt_conn_t *c, uintptr_t data);
72 nxt_conn_t *c);
75 static void nxt_h1p_idle_response(nxt_task_t *task, nxt_conn_t *c);
81 static nxt_msec_t nxt_h1p_idle_response_timer_value(nxt_conn_t *c,
83 static void nxt_h1p_shutdown(nxt_task_t *task, nxt_conn_t *c);
84 static void nxt_h1p_closing(nxt_task_t *task, nxt_conn_t *c);
95 static ssize_t nxt_h1p_peer_io_read_handler(nxt_task_t *task, nxt_conn_t *c);
107 static nxt_msec_t nxt_h1p_peer_timer_value(nxt_conn_t *c, uintptr_t data);
214 nxt_conn_t *c; in nxt_http_conn_init() local
220 c = obj; in nxt_http_conn_init()
227 c->local = skcf->sockaddr; in nxt_http_conn_init()
230 c->read_work_queue = &engine->fast_work_queue; in nxt_http_conn_init()
231 c->write_work_queue = &engine->fast_work_queue; in nxt_http_conn_init()
233 c->read_state = &nxt_h1p_idle_state; in nxt_http_conn_init()
237 c->read_state = &nxt_http_idle_state; in nxt_http_conn_init()
241 nxt_conn_read(engine, c); in nxt_http_conn_init()
263 nxt_http_idle_io_read_handler(nxt_task_t *task, nxt_conn_t *c) in nxt_http_idle_io_read_handler() argument
270 joint = c->listen->socket.data; in nxt_http_idle_io_read_handler()
277 c->read_state = &nxt_h1p_idle_close_state; in nxt_http_idle_io_read_handler()
285 c->socket.error = NXT_ENOMEM; in nxt_http_idle_io_read_handler()
294 n = c->io->recv(c, b->mem.pos, 16, MSG_PEEK); in nxt_http_idle_io_read_handler()
297 c->read = b; in nxt_http_idle_io_read_handler()
300 c->read = NULL; in nxt_http_idle_io_read_handler()
313 nxt_conn_t *c; in nxt_http_conn_test() local
318 c = obj; in nxt_http_conn_test()
323 b = c->read; in nxt_http_conn_test()
326 c->read_state = &nxt_h1p_idle_state; in nxt_http_conn_test()
331 nxt_conn_read(engine, c); in nxt_http_conn_test()
360 c->read = NULL; in nxt_http_conn_test()
363 joint = c->listen->socket.data; in nxt_http_conn_test()
370 nxt_h1p_closing(task, c); in nxt_http_conn_test()
376 tls->conn_init(task, tls, c); in nxt_http_conn_test()
399 nxt_h1p_idle_io_read_handler(nxt_task_t *task, nxt_conn_t *c) in nxt_h1p_idle_io_read_handler() argument
406 joint = c->listen->socket.data; in nxt_h1p_idle_io_read_handler()
413 c->read_state = &nxt_h1p_idle_close_state; in nxt_h1p_idle_io_read_handler()
417 b = c->read; in nxt_h1p_idle_io_read_handler()
424 c->socket.error = NXT_ENOMEM; in nxt_h1p_idle_io_read_handler()
429 n = c->io->recvbuf(c, b); in nxt_h1p_idle_io_read_handler()
432 c->read = b; in nxt_h1p_idle_io_read_handler()
435 c->read = NULL; in nxt_h1p_idle_io_read_handler()
446 nxt_conn_t *c; in nxt_h1p_conn_proto_init() local
449 c = obj; in nxt_h1p_conn_proto_init()
453 h1p = nxt_mp_zget(c->mem_pool, sizeof(nxt_h1proto_t)); in nxt_h1p_conn_proto_init()
455 nxt_h1p_closing(task, c); in nxt_h1p_conn_proto_init()
459 c->socket.data = h1p; in nxt_h1p_conn_proto_init()
460 h1p->conn = c; in nxt_h1p_conn_proto_init()
462 nxt_h1p_conn_request_init(task, c, h1p); in nxt_h1p_conn_proto_init()
470 nxt_conn_t *c; in nxt_h1p_conn_request_init() local
476 c = obj; in nxt_h1p_conn_request_init()
481 nxt_conn_active(task->thread->engine, c); in nxt_h1p_conn_request_init()
490 r->remote = c->remote; in nxt_h1p_conn_request_init()
493 r->tls = (c->u.tls != NULL); in nxt_h1p_conn_request_init()
496 r->task = c->task; in nxt_h1p_conn_request_init()
498 c->socket.task = task; in nxt_h1p_conn_request_init()
499 c->read_timer.task = task; in nxt_h1p_conn_request_init()
500 c->write_timer.task = task; in nxt_h1p_conn_request_init()
505 joint = c->listen->socket.data; in nxt_h1p_conn_request_init()
512 if (c->local == NULL) { in nxt_h1p_conn_request_init()
513 c->local = skcf->sockaddr; in nxt_h1p_conn_request_init()
518 nxt_h1p_conn_request_header_parse(task, c, h1p); in nxt_h1p_conn_request_init()
529 nxt_h1p_closing(task, c); in nxt_h1p_conn_request_init()
550 nxt_conn_t *c; in nxt_h1p_conn_request_header_parse() local
555 c = obj; in nxt_h1p_conn_request_header_parse()
560 ret = nxt_http_parse_request(&h1p->parser, &c->read->mem); in nxt_h1p_conn_request_header_parse()
565 nxt_timer_disable(task->thread->engine, &c->read_timer); in nxt_h1p_conn_request_header_parse()
594 if (c->u.tls == NULL && r->conf->socket_conf->tls != NULL) { in nxt_h1p_conn_request_header_parse()
608 status = nxt_h1p_header_buffer_test(task, h1p, c, r->conf->socket_conf); in nxt_h1p_conn_request_header_parse()
611 c->read_state = &nxt_h1p_header_parse_state; in nxt_h1p_conn_request_header_parse()
613 nxt_conn_read(task->thread->engine, c); in nxt_h1p_conn_request_header_parse()
714 nxt_h1p_header_buffer_test(nxt_task_t *task, nxt_h1proto_t *h1p, nxt_conn_t *c, in nxt_h1p_header_buffer_test() argument
720 in = c->read; in nxt_h1p_header_buffer_test()
730 b = nxt_buf_mem_alloc(c->mem_pool, size, 0); in nxt_h1p_header_buffer_test()
741 c->read = b; in nxt_h1p_header_buffer_test()
857 nxt_conn_t *c; in nxt_h1p_request_body_read() local
981 c = h1p->conn; in nxt_h1p_request_body_read()
982 c->read = b; in nxt_h1p_request_body_read()
983 c->read_state = &nxt_h1p_read_body_state; in nxt_h1p_request_body_read()
985 nxt_conn_read(task->thread->engine, c); in nxt_h1p_request_body_read()
1030 nxt_conn_t *c; in nxt_h1p_conn_request_body_read() local
1035 c = obj; in nxt_h1p_conn_request_body_read()
1044 b = c->read; in nxt_h1p_conn_request_body_read()
1076 body_rest = nxt_buf_mem_free_size(&c->read->mem); in nxt_h1p_conn_request_body_read()
1082 nxt_conn_read(engine, c); in nxt_h1p_conn_request_body_read()
1092 c->read = NULL; in nxt_h1p_conn_request_body_read()
1217 nxt_conn_t *c; in nxt_h1p_request_header_send() local
1376 c = h1p->conn; in nxt_h1p_request_header_send()
1378 c->write = header; in nxt_h1p_request_header_send()
1380 c->write_state = &nxt_h1p_request_send_state; in nxt_h1p_request_header_send()
1395 nxt_conn_write(task->thread->engine, c); in nxt_h1p_request_header_send()
1398 nxt_h1p_websocket_first_frame_start(task, r, c->read); in nxt_h1p_request_header_send()
1408 nxt_conn_t *c; in nxt_h1p_complete_buffers() local
1413 c = h1p->conn; in nxt_h1p_complete_buffers()
1414 in = c->read; in nxt_h1p_complete_buffers()
1420 c->read = in; in nxt_h1p_complete_buffers()
1445 c->read = NULL; in nxt_h1p_complete_buffers()
1467 nxt_conn_t *c; in nxt_h1p_request_send() local
1473 c = h1p->conn; in nxt_h1p_request_send()
1483 if (c->write == NULL) { in nxt_h1p_request_send()
1484 c->write = out; in nxt_h1p_request_send()
1485 c->write_state = &nxt_h1p_request_send_state; in nxt_h1p_request_send()
1487 nxt_conn_write(task->thread->engine, c); in nxt_h1p_request_send()
1572 nxt_conn_t *c; in nxt_h1p_request_discard() local
1581 c = h1p->conn; in nxt_h1p_request_discard()
1582 b = c->write; in nxt_h1p_request_discard()
1583 c->write = NULL; in nxt_h1p_request_discard()
1624 nxt_conn_t *c; in nxt_h1p_conn_request_timeout() local
1633 c = nxt_read_timer_conn(timer); in nxt_h1p_conn_request_timeout()
1634 c->block_read = 1; in nxt_h1p_conn_request_timeout()
1639 c->socket.timedout = 0; in nxt_h1p_conn_request_timeout()
1641 h1p = c->socket.data; in nxt_h1p_conn_request_timeout()
1656 nxt_conn_t *c; in nxt_h1p_conn_request_send_timeout() local
1664 c = nxt_write_timer_conn(timer); in nxt_h1p_conn_request_send_timeout()
1665 c->block_write = 1; in nxt_h1p_conn_request_send_timeout()
1666 h1p = c->socket.data; in nxt_h1p_conn_request_send_timeout()
1673 nxt_h1p_conn_request_timer_value(nxt_conn_t *c, uintptr_t data) in nxt_h1p_conn_request_timer_value() argument
1677 h1p = c->socket.data; in nxt_h1p_conn_request_timer_value()
1697 nxt_conn_t *c; in nxt_h1p_request_close() local
1708 c = h1p->conn; in nxt_h1p_request_close()
1709 task = &c->task; in nxt_h1p_request_close()
1710 c->socket.task = task; in nxt_h1p_request_close()
1711 c->read_timer.task = task; in nxt_h1p_request_close()
1712 c->write_timer.task = task; in nxt_h1p_request_close()
1715 nxt_h1p_keepalive(task, h1p, c); in nxt_h1p_request_close()
1718 nxt_h1p_shutdown(task, c); in nxt_h1p_request_close()
1726 nxt_conn_t *c; in nxt_h1p_conn_sent() local
1729 c = obj; in nxt_h1p_conn_sent()
1735 c->write = nxt_sendbuf_completion(task, &engine->fast_work_queue, c->write); in nxt_h1p_conn_sent()
1737 if (c->write != NULL) { in nxt_h1p_conn_sent()
1738 nxt_conn_write(engine, c); in nxt_h1p_conn_sent()
1746 nxt_conn_t *c; in nxt_h1p_conn_close() local
1748 c = obj; in nxt_h1p_conn_close()
1752 nxt_conn_active(task->thread->engine, c); in nxt_h1p_conn_close()
1754 nxt_h1p_shutdown(task, c); in nxt_h1p_conn_close()
1761 nxt_conn_t *c; in nxt_h1p_conn_error() local
1763 c = obj; in nxt_h1p_conn_error()
1767 nxt_conn_active(task->thread->engine, c); in nxt_h1p_conn_error()
1769 nxt_h1p_shutdown(task, c); in nxt_h1p_conn_error()
1774 nxt_h1p_conn_timer_value(nxt_conn_t *c, uintptr_t data) in nxt_h1p_conn_timer_value() argument
1778 joint = c->listen->socket.data; in nxt_h1p_conn_timer_value()
1793 nxt_h1p_keepalive(nxt_task_t *task, nxt_h1proto_t *h1p, nxt_conn_t *c) in nxt_h1p_keepalive() argument
1801 if (!c->tcp_nodelay) { in nxt_h1p_keepalive()
1802 nxt_conn_tcp_nodelay_on(task, c); in nxt_h1p_keepalive()
1807 in = c->read; in nxt_h1p_keepalive()
1811 c->sent = 0; in nxt_h1p_keepalive()
1815 nxt_conn_idle(engine, c); in nxt_h1p_keepalive()
1818 c->read_state = &nxt_h1p_keepalive_state; in nxt_h1p_keepalive()
1820 nxt_conn_read(engine, c); in nxt_h1p_keepalive()
1832 nxt_h1p_conn_request_init(task, c, c->socket.data); in nxt_h1p_keepalive()
1863 nxt_conn_t *c; in nxt_h1p_idle_close() local
1865 c = obj; in nxt_h1p_idle_close()
1869 nxt_conn_active(task->thread->engine, c); in nxt_h1p_idle_close()
1871 nxt_h1p_idle_response(task, c); in nxt_h1p_idle_close()
1878 nxt_conn_t *c; in nxt_h1p_idle_timeout() local
1885 c = nxt_read_timer_conn(timer); in nxt_h1p_idle_timeout()
1886 c->block_read = 1; in nxt_h1p_idle_timeout()
1888 nxt_conn_active(task->thread->engine, c); in nxt_h1p_idle_timeout()
1890 nxt_h1p_idle_response(task, c); in nxt_h1p_idle_timeout()
1903 nxt_h1p_idle_response(nxt_task_t *task, nxt_conn_t *c) in nxt_h1p_idle_response() argument
1913 out = nxt_buf_mem_alloc(c->mem_pool, size, 0); in nxt_h1p_idle_response()
1925 last = nxt_mp_zget(c->mem_pool, NXT_BUF_SYNC_SIZE); in nxt_h1p_idle_response()
1935 last->parent = c; in nxt_h1p_idle_response()
1937 c->write = out; in nxt_h1p_idle_response()
1938 c->write_state = &nxt_h1p_timeout_response_state; in nxt_h1p_idle_response()
1940 nxt_conn_write(task->thread->engine, c); in nxt_h1p_idle_response()
1945 nxt_h1p_shutdown(task, c); in nxt_h1p_idle_response()
1963 nxt_conn_t *c; in nxt_h1p_idle_response_sent() local
1965 c = data; in nxt_h1p_idle_response_sent()
1969 nxt_h1p_shutdown(task, c); in nxt_h1p_idle_response_sent()
1976 nxt_conn_t *c; in nxt_h1p_idle_response_error() local
1978 c = obj; in nxt_h1p_idle_response_error()
1982 nxt_h1p_shutdown(task, c); in nxt_h1p_idle_response_error()
1989 nxt_conn_t *c; in nxt_h1p_idle_response_timeout() local
1996 c = nxt_read_timer_conn(timer); in nxt_h1p_idle_response_timeout()
1997 c->block_write = 1; in nxt_h1p_idle_response_timeout()
1999 nxt_h1p_shutdown(task, c); in nxt_h1p_idle_response_timeout()
2004 nxt_h1p_idle_response_timer_value(nxt_conn_t *c, uintptr_t data) in nxt_h1p_idle_response_timer_value() argument
2011 nxt_h1p_shutdown(nxt_task_t *task, nxt_conn_t *c) in nxt_h1p_shutdown() argument
2018 h1p = c->socket.data; in nxt_h1p_shutdown()
2038 nxt_h1p_closing(task, c); in nxt_h1p_shutdown()
2058 nxt_h1p_closing(nxt_task_t *task, nxt_conn_t *c) in nxt_h1p_closing() argument
2062 c->socket.data = NULL; in nxt_h1p_closing()
2066 if (c->u.tls != NULL) { in nxt_h1p_closing()
2067 c->write_state = &nxt_h1p_shutdown_state; in nxt_h1p_closing()
2069 c->io->shutdown(task, c, NULL); in nxt_h1p_closing()
2075 nxt_h1p_conn_closing(task, c, NULL); in nxt_h1p_closing()
2095 nxt_conn_t *c; in nxt_h1p_conn_closing() local
2097 c = obj; in nxt_h1p_conn_closing()
2101 c->write_state = &nxt_h1p_close_state; in nxt_h1p_conn_closing()
2103 nxt_conn_close(task->thread->engine, c); in nxt_h1p_conn_closing()
2117 nxt_conn_t *c; in nxt_h1p_conn_free() local
2121 c = obj; in nxt_h1p_conn_free()
2127 nxt_sockaddr_cache_free(engine, c); in nxt_h1p_conn_free()
2129 lev = c->listen; in nxt_h1p_conn_free()
2131 nxt_conn_free(task, c); in nxt_h1p_conn_free()
2142 nxt_conn_t *c, *client; in nxt_h1p_peer_connect() local
2169 c = nxt_conn_create(mp, task); in nxt_h1p_peer_connect()
2170 if (nxt_slow_path(c == NULL)) { in nxt_h1p_peer_connect()
2174 c->mem_pool = mp; in nxt_h1p_peer_connect()
2175 h1p->conn = c; in nxt_h1p_peer_connect()
2180 c->socket.data = peer; in nxt_h1p_peer_connect()
2181 c->remote = peer->server->sockaddr; in nxt_h1p_peer_connect()
2183 c->socket.write_ready = 1; in nxt_h1p_peer_connect()
2184 c->write_state = &nxt_h1p_peer_connect_state; in nxt_h1p_peer_connect()
2193 c->read_work_queue = wq; in nxt_h1p_peer_connect()
2194 c->socket.read_work_queue = wq; in nxt_h1p_peer_connect()
2195 c->read_timer.work_queue = wq; in nxt_h1p_peer_connect()
2198 c->write_work_queue = wq; in nxt_h1p_peer_connect()
2199 c->socket.write_work_queue = wq; in nxt_h1p_peer_connect()
2200 c->write_timer.work_queue = wq; in nxt_h1p_peer_connect()
2203 nxt_conn_connect(task->thread->engine, c); in nxt_h1p_peer_connect()
2267 nxt_conn_t *c; in nxt_h1p_peer_header_send() local
2318 c = peer->proto.h1->conn; in nxt_h1p_peer_header_send()
2319 c->write = header; in nxt_h1p_peer_header_send()
2320 c->write_state = &nxt_h1p_peer_header_send_state; in nxt_h1p_peer_header_send()
2352 c->write_state = &nxt_h1p_peer_header_body_send_state; in nxt_h1p_peer_header_send()
2355 nxt_conn_write(task->thread->engine, c); in nxt_h1p_peer_header_send()
2387 nxt_conn_t *c; in nxt_h1p_peer_header_sent() local
2392 c = obj; in nxt_h1p_peer_header_sent()
2399 c->write = nxt_sendbuf_completion(task, &engine->fast_work_queue, c->write); in nxt_h1p_peer_header_sent()
2401 if (c->write != NULL) { in nxt_h1p_peer_header_sent()
2402 nxt_conn_write(engine, c); in nxt_h1p_peer_header_sent()
2414 nxt_conn_t *c; in nxt_h1p_peer_header_read() local
2418 c = peer->proto.h1->conn; in nxt_h1p_peer_header_read()
2420 if (c->write_timer.enabled) { in nxt_h1p_peer_header_read()
2421 c->read_state = &nxt_h1p_peer_header_read_state; in nxt_h1p_peer_header_read()
2424 c->read_state = &nxt_h1p_peer_header_read_timer_state; in nxt_h1p_peer_header_read()
2427 nxt_conn_read(task->thread->engine, c); in nxt_h1p_peer_header_read()
2458 nxt_h1p_peer_io_read_handler(nxt_task_t *task, nxt_conn_t *c) in nxt_h1p_peer_io_read_handler() argument
2467 peer = c->socket.data; in nxt_h1p_peer_io_read_handler()
2469 b = c->read; in nxt_h1p_peer_io_read_handler()
2481 c->socket.error = NXT_ENOMEM; in nxt_h1p_peer_io_read_handler()
2486 n = c->io->recvbuf(c, b); in nxt_h1p_peer_io_read_handler()
2489 c->read = b; in nxt_h1p_peer_io_read_handler()
2492 c->read = NULL; in nxt_h1p_peer_io_read_handler()
2505 nxt_conn_t *c; in nxt_h1p_peer_header_read_done() local
2511 c = obj; in nxt_h1p_peer_header_read_done()
2516 b = c->read; in nxt_h1p_peer_header_read_done()
2526 nxt_timer_disable(engine, &c->write_timer); in nxt_h1p_peer_header_read_done()
2527 nxt_timer_disable(engine, &c->read_timer); in nxt_h1p_peer_header_read_done()
2542 c->read = NULL; in nxt_h1p_peer_header_read_done()
2554 h1p->chunked_parse.mem_pool = c->mem_pool; in nxt_h1p_peer_header_read_done()
2570 nxt_conn_read(task->thread->engine, c); in nxt_h1p_peer_header_read_done()
2639 nxt_conn_t *c; in nxt_h1p_peer_read() local
2643 c = peer->proto.h1->conn; in nxt_h1p_peer_read()
2644 c->read_state = &nxt_h1p_peer_read_state; in nxt_h1p_peer_read()
2646 nxt_conn_read(task->thread->engine, c); in nxt_h1p_peer_read()
2670 nxt_conn_t *c; in nxt_h1p_peer_read_done() local
2673 c = obj; in nxt_h1p_peer_read_done()
2678 out = c->read; in nxt_h1p_peer_read_done()
2679 c->read = NULL; in nxt_h1p_peer_read_done()
2769 nxt_conn_t *c; in nxt_h1p_peer_send_timeout() local
2778 c = nxt_write_timer_conn(timer); in nxt_h1p_peer_send_timeout()
2779 c->block_write = 1; in nxt_h1p_peer_send_timeout()
2780 c->block_read = 1; in nxt_h1p_peer_send_timeout()
2782 peer = c->socket.data; in nxt_h1p_peer_send_timeout()
2793 nxt_conn_t *c; in nxt_h1p_peer_read_timeout() local
2802 c = nxt_read_timer_conn(timer); in nxt_h1p_peer_read_timeout()
2803 c->block_write = 1; in nxt_h1p_peer_read_timeout()
2804 c->block_read = 1; in nxt_h1p_peer_read_timeout()
2806 peer = c->socket.data; in nxt_h1p_peer_read_timeout()
2815 nxt_h1p_peer_timer_value(nxt_conn_t *c, uintptr_t data) in nxt_h1p_peer_timer_value() argument
2819 peer = c->socket.data; in nxt_h1p_peer_timer_value()
2828 nxt_conn_t *c; in nxt_h1p_peer_close() local
2834 c = peer->proto.h1->conn; in nxt_h1p_peer_close()
2835 task = &c->task; in nxt_h1p_peer_close()
2836 c->socket.task = task; in nxt_h1p_peer_close()
2837 c->read_timer.task = task; in nxt_h1p_peer_close()
2838 c->write_timer.task = task; in nxt_h1p_peer_close()
2840 if (c->socket.fd != -1) { in nxt_h1p_peer_close()
2841 c->write_state = &nxt_h1p_peer_close_state; in nxt_h1p_peer_close()
2843 nxt_conn_close(task->thread->engine, c); in nxt_h1p_peer_close()
2846 nxt_h1p_peer_free(task, c, NULL); in nxt_h1p_peer_close()
2861 nxt_conn_t *c; in nxt_h1p_peer_free() local
2863 c = obj; in nxt_h1p_peer_free()
2867 nxt_conn_free(task, c); in nxt_h1p_peer_free()