Lines Matching refs:p

20 static void nxt_conn_proxy_read_process(nxt_task_t *task, nxt_conn_proxy_t *p,
28 static void nxt_conn_proxy_write_process(nxt_task_t *task, nxt_conn_proxy_t *p,
41 static void nxt_conn_proxy_shutdown(nxt_task_t *task, nxt_conn_proxy_t *p,
45 static void nxt_conn_proxy_complete(nxt_task_t *task, nxt_conn_proxy_t *p);
64 nxt_conn_proxy_t *p; in nxt_conn_proxy_create() local
66 p = nxt_mp_zget(client->mem_pool, sizeof(nxt_conn_proxy_t)); in nxt_conn_proxy_create()
67 if (nxt_slow_path(p == NULL)) { in nxt_conn_proxy_create()
92 p->client = client; in nxt_conn_proxy_create()
93 p->peer = peer; in nxt_conn_proxy_create()
95 return p; in nxt_conn_proxy_create()
100 nxt_conn_proxy(nxt_task_t *task, nxt_conn_proxy_t *p) in nxt_conn_proxy() argument
109 if (p->client_wait_timeout == 0) { in nxt_conn_proxy()
114 peer = p->peer; in nxt_conn_proxy()
124 p->client->read_state = &nxt_conn_proxy_client_wait_state; in nxt_conn_proxy()
126 nxt_conn_wait(p->client); in nxt_conn_proxy()
148 nxt_conn_proxy_t *p; in nxt_conn_proxy_client_buffer_alloc() local
151 p = data; in nxt_conn_proxy_client_buffer_alloc()
155 b = nxt_buf_mem_alloc(client->mem_pool, p->client_buffer_size, 0); in nxt_conn_proxy_client_buffer_alloc()
158 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_client_buffer_alloc()
162 p->client_buffer = b; in nxt_conn_proxy_client_buffer_alloc()
165 if (p->peer->socket.fd != -1) { in nxt_conn_proxy_client_buffer_alloc()
208 nxt_conn_proxy_t *p; in nxt_conn_proxy_peer_connect() local
211 p = data; in nxt_conn_proxy_peer_connect()
222 p->peer->write_state = &nxt_conn_proxy_peer_connect_state; in nxt_conn_proxy_peer_connect()
224 nxt_conn_connect(task->thread->engine, p->peer); in nxt_conn_proxy_peer_connect()
246 nxt_conn_proxy_t *p; in nxt_conn_proxy_connected() local
249 p = data; in nxt_conn_proxy_connected()
253 p->connected = 1; in nxt_conn_proxy_connected()
256 nxt_conn_tcp_nodelay_on(task, p->client); in nxt_conn_proxy_connected()
265 if (p->client_buffer != NULL) { in nxt_conn_proxy_connected()
266 client = p->client; in nxt_conn_proxy_connected()
274 nxt_conn_proxy_read_process(task, p, client, peer); in nxt_conn_proxy_connected()
297 nxt_conn_proxy_t *p; in nxt_conn_proxy_peer_read() local
300 p = data; in nxt_conn_proxy_peer_read()
304 b = nxt_buf_mem_alloc(peer->mem_pool, p->peer_buffer_size, 0); in nxt_conn_proxy_peer_read()
307 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_peer_read()
311 p->peer_buffer = b; in nxt_conn_proxy_peer_read()
314 p->client->write_state = &nxt_conn_proxy_client_write_state; in nxt_conn_proxy_peer_read()
341 nxt_conn_proxy_t *p; in nxt_conn_proxy_client_read_ready() local
344 p = data; in nxt_conn_proxy_client_read_ready()
348 nxt_conn_proxy_read_process(task, p, client, p->peer); in nxt_conn_proxy_client_read_ready()
365 nxt_conn_proxy_t *p; in nxt_conn_proxy_peer_read_ready() local
368 p = data; in nxt_conn_proxy_peer_read_ready()
372 nxt_conn_proxy_read_process(task, p, peer, p->client); in nxt_conn_proxy_peer_read_ready()
377 nxt_conn_proxy_read_process(nxt_task_t *task, nxt_conn_proxy_t *p, in nxt_conn_proxy_read_process() argument
401 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_read_process()
426 if (p->connected) { in nxt_conn_proxy_read_process()
494 nxt_conn_proxy_t *p; in nxt_conn_proxy_read() local
497 p = data; in nxt_conn_proxy_read()
502 sink = (source == p->client) ? p->peer : p->client; in nxt_conn_proxy_read()
528 nxt_conn_proxy_t *p; in nxt_conn_proxy_client_write_ready() local
531 p = data; in nxt_conn_proxy_client_write_ready()
535 nxt_conn_proxy_write_process(task, p, client, p->peer); in nxt_conn_proxy_client_write_ready()
556 nxt_conn_proxy_t *p; in nxt_conn_proxy_peer_write_ready() local
559 p = data; in nxt_conn_proxy_peer_write_ready()
563 nxt_conn_proxy_write_process(task, p, peer, p->client); in nxt_conn_proxy_peer_write_ready()
568 nxt_conn_proxy_write_process(nxt_task_t *task, nxt_conn_proxy_t *p, in nxt_conn_proxy_write_process() argument
583 nxt_conn_proxy_shutdown(task, p, source, sink); in nxt_conn_proxy_write_process()
594 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_write_process()
706 nxt_conn_proxy_t *p; in nxt_conn_proxy_close() local
709 p = data; in nxt_conn_proxy_close()
713 sink = (source == p->client) ? p->peer : p->client; in nxt_conn_proxy_close()
716 nxt_conn_proxy_shutdown(task, p, source, sink); in nxt_conn_proxy_close()
723 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_close()
735 nxt_conn_proxy_t *p; in nxt_conn_proxy_error() local
738 p = data; in nxt_conn_proxy_error()
742 nxt_conn_proxy_close(task, c, p); in nxt_conn_proxy_error()
793 nxt_conn_proxy_t *p; in nxt_conn_proxy_refused() local
796 p = data; in nxt_conn_proxy_refused()
800 if (p->retries == 0) { in nxt_conn_proxy_refused()
802 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_refused()
806 p->retries--; in nxt_conn_proxy_refused()
812 p->delayed = 1; in nxt_conn_proxy_refused()
816 p->reconnect_timeout); in nxt_conn_proxy_refused()
825 nxt_conn_proxy_t *p; in nxt_conn_proxy_reconnect_handler() local
832 p = peer->socket.data; in nxt_conn_proxy_reconnect_handler()
834 if (p->client->socket.closed) { in nxt_conn_proxy_reconnect_handler()
835 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_reconnect_handler()
839 p->delayed = 0; in nxt_conn_proxy_reconnect_handler()
851 nxt_conn_proxy_shutdown(nxt_task_t *task, nxt_conn_proxy_t *p, in nxt_conn_proxy_shutdown() argument
864 if (!p->connected || p->delayed) { in nxt_conn_proxy_shutdown()
865 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_shutdown()
878 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_shutdown()
885 b = (source == p->client) ? p->client_buffer : p->peer_buffer; in nxt_conn_proxy_shutdown()
894 nxt_conn_proxy_t *p; in nxt_conn_proxy_read_error() local
897 p = data; in nxt_conn_proxy_read_error()
901 nxt_conn_proxy_close(task, c, p); in nxt_conn_proxy_read_error()
909 nxt_conn_proxy_t *p; in nxt_conn_proxy_write_error() local
912 p = data; in nxt_conn_proxy_write_error()
920 source = (sink == p->client) ? p->peer : p->client; in nxt_conn_proxy_write_error()
928 nxt_conn_proxy_complete(task, p); in nxt_conn_proxy_write_error()
941 nxt_conn_proxy_complete(nxt_task_t *task, nxt_conn_proxy_t *p) in nxt_conn_proxy_complete() argument
947 nxt_debug(p->client->socket.task, "conn proxy complete %d:%d", in nxt_conn_proxy_complete()
948 p->client->socket.fd, p->peer->socket.fd); in nxt_conn_proxy_complete()
950 if (p->delayed) { in nxt_conn_proxy_complete()
951 p->delayed = 0; in nxt_conn_proxy_complete()
952 nxt_queue_remove(&p->peer->link); in nxt_conn_proxy_complete()
955 if (p->client->socket.fd != -1) { in nxt_conn_proxy_complete()
956 p->retain = 1; in nxt_conn_proxy_complete()
957 p->client->write_state = &nxt_conn_proxy_close_state; in nxt_conn_proxy_complete()
958 nxt_conn_close(engine, p->client); in nxt_conn_proxy_complete()
961 if (p->peer->socket.fd != -1) { in nxt_conn_proxy_complete()
962 p->retain++; in nxt_conn_proxy_complete()
963 p->peer->write_state = &nxt_conn_proxy_close_state; in nxt_conn_proxy_complete()
964 nxt_conn_close(engine, p->peer); in nxt_conn_proxy_complete()
972 nxt_conn_proxy_t *p; in nxt_conn_proxy_completion() local
974 p = data; in nxt_conn_proxy_completion()
976 nxt_debug(p->client->socket.task, "conn proxy completion %d:%d:%d", in nxt_conn_proxy_completion()
977 p->retain, p->client->socket.fd, p->peer->socket.fd); in nxt_conn_proxy_completion()
979 p->retain--; in nxt_conn_proxy_completion()
981 if (p->retain == 0) { in nxt_conn_proxy_completion()
982 nxt_mp_free(p->client->mem_pool, p->client_buffer); in nxt_conn_proxy_completion()
983 nxt_mp_free(p->client->mem_pool, p->peer_buffer); in nxt_conn_proxy_completion()
985 p->completion_handler(task, p, NULL); in nxt_conn_proxy_completion()