Lines Matching refs:task

80 static nxt_int_t nxt_router_prefork(nxt_task_t *task, nxt_process_t *process,
82 static nxt_int_t nxt_router_start(nxt_task_t *task, nxt_process_data_t *data);
83 static void nxt_router_greet_controller(nxt_task_t *task,
86 static nxt_int_t nxt_router_start_app_process(nxt_task_t *task, nxt_app_t *app);
88 static void nxt_router_new_port_handler(nxt_task_t *task,
90 static void nxt_router_conf_data_handler(nxt_task_t *task,
92 static void nxt_router_app_restart_handler(nxt_task_t *task,
94 static void nxt_router_status_handler(nxt_task_t *task,
96 static void nxt_router_remove_pid_handler(nxt_task_t *task,
99 static nxt_router_temp_conf_t *nxt_router_temp_conf(nxt_task_t *task);
100 static void nxt_router_conf_ready(nxt_task_t *task,
102 static void nxt_router_conf_send(nxt_task_t *task,
105 static nxt_int_t nxt_router_conf_create(nxt_task_t *task,
107 static nxt_int_t nxt_router_conf_process_static(nxt_task_t *task,
109 static nxt_http_forward_t *nxt_router_conf_forward(nxt_task_t *task,
120 static void nxt_router_apps_hash_use(nxt_task_t *task, nxt_router_conf_t *rtcf,
123 static nxt_int_t nxt_router_app_queue_init(nxt_task_t *task,
125 static nxt_int_t nxt_router_port_queue_init(nxt_task_t *task,
127 static nxt_int_t nxt_router_port_queue_map(nxt_task_t *task,
129 static void nxt_router_listen_socket_rpc_create(nxt_task_t *task,
131 static void nxt_router_listen_socket_ready(nxt_task_t *task,
133 static void nxt_router_listen_socket_error(nxt_task_t *task,
136 static void nxt_router_tls_rpc_handler(nxt_task_t *task,
142 static void nxt_router_app_rpc_create(nxt_task_t *task,
144 static void nxt_router_app_prefork_ready(nxt_task_t *task,
146 static void nxt_router_app_prefork_error(nxt_task_t *task,
148 static nxt_socket_conf_t *nxt_router_socket_conf(nxt_task_t *task,
153 static nxt_int_t nxt_router_engines_create(nxt_task_t *task,
170 static nxt_int_t nxt_router_threads_create(nxt_task_t *task, nxt_runtime_t *rt,
172 static nxt_int_t nxt_router_thread_create(nxt_task_t *task, nxt_runtime_t *rt,
174 static void nxt_router_apps_sort(nxt_task_t *task, nxt_router_t *router,
183 static void nxt_router_rt_add_port(nxt_task_t *task, void *obj,
185 static void nxt_router_listen_socket_create(nxt_task_t *task, void *obj,
187 static void nxt_router_listen_socket_update(nxt_task_t *task, void *obj,
189 static void nxt_router_listen_socket_delete(nxt_task_t *task, void *obj,
191 static void nxt_router_worker_thread_quit(nxt_task_t *task, void *obj,
193 static void nxt_router_listen_socket_close(nxt_task_t *task, void *obj,
195 static void nxt_router_thread_exit_handler(nxt_task_t *task, void *obj,
197 static void nxt_router_req_headers_ack_handler(nxt_task_t *task,
199 static void nxt_router_listen_socket_release(nxt_task_t *task,
202 static void nxt_router_app_port_ready(nxt_task_t *task,
204 static void nxt_router_app_port_error(nxt_task_t *task,
207 static void nxt_router_app_use(nxt_task_t *task, nxt_app_t *app, int i);
208 static void nxt_router_app_unlink(nxt_task_t *task, nxt_app_t *app);
210 static void nxt_router_app_port_release(nxt_task_t *task, nxt_app_t *app,
212 static void nxt_router_app_port_get(nxt_task_t *task, nxt_app_t *app,
214 static void nxt_router_http_request_error(nxt_task_t *task, void *obj,
216 static void nxt_router_http_request_done(nxt_task_t *task, void *obj,
219 static void nxt_router_app_prepare_request(nxt_task_t *task,
221 static nxt_buf_t *nxt_router_prepare_msg(nxt_task_t *task,
224 static void nxt_router_app_timeout(nxt_task_t *task, void *obj, void *data);
225 static void nxt_router_adjust_idle_timer(nxt_task_t *task, void *obj,
227 static void nxt_router_app_idle_timeout(nxt_task_t *task, void *obj,
229 static void nxt_router_app_joint_release_handler(nxt_task_t *task, void *obj,
231 static void nxt_router_free_app(nxt_task_t *task, void *obj, void *data);
234 static void nxt_http_request_send_body(nxt_task_t *task, void *obj, void *data);
236 static void nxt_router_app_joint_use(nxt_task_t *task,
239 static void nxt_router_http_request_release_post(nxt_task_t *task,
241 static void nxt_router_http_request_release(nxt_task_t *task, void *obj,
243 static void nxt_router_oosm_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
244 static void nxt_router_get_port_handler(nxt_task_t *task,
246 static void nxt_router_get_mmap_handler(nxt_task_t *task,
305 nxt_router_prefork(nxt_task_t *task, nxt_process_t *process, nxt_mp_t *mp) in nxt_router_prefork() argument
307 nxt_runtime_stop_app_processes(task, task->thread->runtime); in nxt_router_prefork()
314 nxt_router_start(nxt_task_t *task, nxt_process_data_t *data) in nxt_router_start() argument
321 rt = task->thread->runtime; in nxt_router_start()
323 nxt_log(task, NXT_LOG_INFO, "router started"); in nxt_router_start()
331 ret = rt->tls->library_init(task); in nxt_router_start()
337 ret = nxt_http_init(task); in nxt_router_start()
355 nxt_router_greet_controller(task, controller_port); in nxt_router_start()
363 nxt_router_greet_controller(nxt_task_t *task, nxt_port_t *controller_port) in nxt_router_greet_controller() argument
365 nxt_port_socket_write(task, controller_port, NXT_PORT_MSG_PROCESS_READY, in nxt_router_greet_controller()
371 nxt_router_start_app_process_handler(nxt_task_t *task, nxt_port_t *port, in nxt_router_start_app_process_handler() argument
393 nxt_debug(task, "app '%V' %p start process", &app->name, app); in nxt_router_start_app_process_handler()
401 nxt_debug(task, "app '%V' %p wait for prototype process", in nxt_router_start_app_process_handler()
409 nxt_debug(task, "app '%V' %p start prototype process", &app->name, app); in nxt_router_start_app_process_handler()
411 rt = task->thread->runtime; in nxt_router_start_app_process_handler()
416 b = nxt_buf_mem_alloc(task->thread->engine->mem_pool, size, 0); in nxt_router_start_app_process_handler()
429 app_joint_rpc = nxt_port_rpc_register_handler_ex(task, port, in nxt_router_start_app_process_handler()
439 ret = nxt_port_socket_write2(task, dport, NXT_PORT_MSG_START_PROCESS, in nxt_router_start_app_process_handler()
442 nxt_port_rpc_cancel(task, port, stream); in nxt_router_start_app_process_handler()
457 nxt_router_app_joint_use(task, app->joint, 1); in nxt_router_start_app_process_handler()
467 nxt_router_app_use(task, app, -1); in nxt_router_start_app_process_handler()
472 nxt_router_app_joint_use(nxt_task_t *task, nxt_app_joint_t *app_joint, int i) in nxt_router_app_joint_use() argument
485 nxt_router_start_app_process(nxt_task_t *task, nxt_app_t *app) in nxt_router_start_app_process() argument
491 nxt_debug(task, "app '%V' start process", &app->name); in nxt_router_start_app_process()
493 rt = task->thread->runtime; in nxt_router_start_app_process()
496 nxt_router_app_use(task, app, 1); in nxt_router_start_app_process()
498 res = nxt_port_post(task, router_port, nxt_router_start_app_process_handler, in nxt_router_start_app_process()
511 nxt_router_app_use(task, app, -1); in nxt_router_start_app_process()
518 nxt_router_msg_cancel(nxt_task_t *task, nxt_request_rpc_data_t *req_rpc_data) in nxt_router_msg_cancel() argument
539 nxt_debug(task, "stream #%uD: cancelled by router", in nxt_router_msg_cancel()
555 b->completion_handler(task, b, b->parent); in nxt_router_msg_cancel()
580 nxt_request_rpc_data_unlink(nxt_task_t *task, in nxt_request_rpc_data_unlink() argument
587 nxt_router_msg_cancel(task, req_rpc_data); in nxt_request_rpc_data_unlink()
592 nxt_router_app_port_release(task, app, req_rpc_data->app_port, in nxt_request_rpc_data_unlink()
603 nxt_router_http_request_release_post(task, r); in nxt_request_rpc_data_unlink()
629 nxt_router_app_use(task, app, -1); in nxt_request_rpc_data_unlink()
643 nxt_port_rpc_cancel(task, task->thread->engine->port, in nxt_request_rpc_data_unlink()
650 nxt_router_new_port_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_router_new_port_handler() argument
657 nxt_port_new_port_handler(task, msg); in nxt_router_new_port_handler()
662 nxt_router_greet_controller(task, msg->u.new_port); in nxt_router_new_port_handler()
666 nxt_port_rpc_handler(task, msg); in nxt_router_new_port_handler()
681 res = nxt_router_port_queue_map(task, port, msg->fd[1]); in nxt_router_new_port_handler()
692 nxt_port_rpc_handler(task, msg); in nxt_router_new_port_handler()
696 nxt_debug(task, "new port id %d (%d)", port->id, port->type); in nxt_router_new_port_handler()
705 rt = task->thread->runtime; in nxt_router_new_port_handler()
731 nxt_port_socket_write(task, port, NXT_PORT_MSG_PORT_ACK, -1, 0, 0, NULL); in nxt_router_new_port_handler()
736 nxt_router_conf_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_router_conf_data_handler() argument
744 port = nxt_runtime_port_find(task->thread->runtime, in nxt_router_conf_data_handler()
748 nxt_alert(task, "conf_data_handler: reply port not found"); in nxt_router_conf_data_handler()
760 tmcf = nxt_router_temp_conf(task); in nxt_router_conf_data_handler()
766 nxt_alert(task, "conf_data_handler: invalid shm fd"); in nxt_router_conf_data_handler()
771 nxt_alert(task, "conf_data_handler: unexpected buffer size (%d)", in nxt_router_conf_data_handler()
787 nxt_debug(task, "conf_data_handler(%uz): %*s", size, size, p); in nxt_router_conf_data_handler()
793 nxt_port_use(task, tmcf->port, 1); in nxt_router_conf_data_handler()
795 ret = nxt_router_conf_create(task, tmcf, p, nxt_pointer_to(p, size)); in nxt_router_conf_data_handler()
798 nxt_router_conf_apply(task, tmcf, NULL); in nxt_router_conf_data_handler()
801 nxt_router_conf_error(task, tmcf); in nxt_router_conf_data_handler()
808 nxt_port_socket_write(task, port, NXT_PORT_MSG_RPC_ERROR, -1, in nxt_router_conf_data_handler()
829 nxt_router_app_restart_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_router_app_restart_handler() argument
838 reply_port = nxt_runtime_port_find(task->thread->runtime, in nxt_router_app_restart_handler()
842 nxt_alert(task, "app_restart_handler: reply port not found"); in nxt_router_app_restart_handler()
849 nxt_debug(task, "app_restart_handler: %V", &app_name); in nxt_router_app_restart_handler()
854 shared_port = nxt_port_new(task, NXT_SHARED_PORT_ID, nxt_pid, in nxt_router_app_restart_handler()
860 ret = nxt_port_socket_init(task, shared_port, 0); in nxt_router_app_restart_handler()
862 nxt_port_use(task, shared_port, -1); in nxt_router_app_restart_handler()
866 ret = nxt_router_app_queue_init(task, shared_port); in nxt_router_app_restart_handler()
870 nxt_port_use(task, shared_port, -1); in nxt_router_app_restart_handler()
874 nxt_port_write_enable(task, shared_port); in nxt_router_app_restart_handler()
881 nxt_debug(task, "send QUIT to prototype '%V' pid %PI", &app->name, in nxt_router_app_restart_handler()
899 nxt_port_close(task, old_shared_port); in nxt_router_app_restart_handler()
900 nxt_port_use(task, old_shared_port, -1); in nxt_router_app_restart_handler()
903 (void) nxt_port_socket_write(task, proto_port, NXT_PORT_MSG_QUIT, in nxt_router_app_restart_handler()
906 nxt_port_close(task, proto_port); in nxt_router_app_restart_handler()
908 nxt_port_use(task, proto_port, -1); in nxt_router_app_restart_handler()
920 nxt_port_socket_write(task, reply_port, reply, -1, msg->port_msg.stream, in nxt_router_app_restart_handler()
926 nxt_router_status_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_router_status_handler() argument
938 port = nxt_runtime_port_find(task->thread->runtime, in nxt_router_status_handler()
942 nxt_alert(task, "nxt_router_status_handler(): reply port not found"); in nxt_router_status_handler()
999 nxt_port_socket_write(task, port, type, -1, msg->port_msg.stream, 0, b); in nxt_router_status_handler()
1004 nxt_router_app_process_remove_pid(nxt_task_t *task, nxt_port_t *port, in nxt_router_app_process_remove_pid() argument
1014 nxt_port_rpc_remove_peer(task, port, u.removed_pid); in nxt_router_app_process_remove_pid()
1019 nxt_router_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_router_remove_pid_handler() argument
1023 nxt_port_remove_pid_handler(task, msg); in nxt_router_remove_pid_handler()
1028 nxt_port_post(task, engine->port, nxt_router_app_process_remove_pid, in nxt_router_remove_pid_handler()
1040 nxt_port_rpc_handler(task, msg); in nxt_router_remove_pid_handler()
1045 nxt_router_temp_conf(nxt_task_t *task) in nxt_router_temp_conf() argument
1081 tmcf->engine = task->thread->engine; in nxt_router_temp_conf()
1135 nxt_router_conf_apply(nxt_task_t *task, void *obj, void *data) in nxt_router_conf_apply() argument
1160 nxt_router_listen_socket_rpc_create(task, tmcf, skcf); in nxt_router_conf_apply()
1173 nxt_cert_store_get(task, &tls->name, tmcf->mem_pool, in nxt_router_conf_apply()
1182 nxt_router_app_rpc_create(task, tmcf, app); in nxt_router_conf_apply()
1191 nxt_router_access_log_open(task, tmcf); in nxt_router_conf_apply()
1195 rt = task->thread->runtime; in nxt_router_conf_apply()
1201 ret = nxt_router_engines_create(task, router, tmcf, interface); in nxt_router_conf_apply()
1206 ret = nxt_router_threads_create(task, rt, tmcf); in nxt_router_conf_apply()
1211 nxt_router_apps_sort(task, router, tmcf); in nxt_router_conf_apply()
1213 nxt_router_apps_hash_use(task, rtcf, 1); in nxt_router_conf_apply()
1223 nxt_router_access_log_release(task, &router->lock, router->access_log); in nxt_router_conf_apply()
1228 nxt_router_conf_ready(task, tmcf); in nxt_router_conf_apply()
1234 nxt_router_conf_error(task, tmcf); in nxt_router_conf_apply()
1241 nxt_router_conf_wait(nxt_task_t *task, void *obj, void *data) in nxt_router_conf_wait() argument
1247 nxt_router_conf_ready(task, job->tmcf); in nxt_router_conf_wait()
1252 nxt_router_conf_ready(nxt_task_t *task, nxt_router_temp_conf_t *tmcf) in nxt_router_conf_ready() argument
1258 nxt_debug(task, "temp conf %p count: %D", tmcf, tmcf->count); in nxt_router_conf_ready()
1264 nxt_router_conf_send(task, tmcf, NXT_PORT_MSG_RPC_READY_LAST); in nxt_router_conf_ready()
1276 nxt_debug(task, "rtcf %p: %D", rtcf, count); in nxt_router_conf_ready()
1279 nxt_router_apps_hash_use(task, rtcf, -1); in nxt_router_conf_ready()
1281 nxt_router_access_log_release(task, lock, rtcf->access_log); in nxt_router_conf_ready()
1291 nxt_router_conf_error(nxt_task_t *task, nxt_router_temp_conf_t *tmcf) in nxt_router_conf_error() argument
1300 nxt_alert(task, "failed to apply new conf"); in nxt_router_conf_error()
1310 nxt_socket_close(task, s); in nxt_router_conf_error()
1320 nxt_router_app_unlink(task, app); in nxt_router_conf_error()
1333 nxt_router_access_log_release(task, &router->lock, rtcf->access_log); in nxt_router_conf_error()
1337 nxt_router_conf_send(task, tmcf, NXT_PORT_MSG_RPC_ERROR); in nxt_router_conf_error()
1344 nxt_router_conf_send(nxt_task_t *task, nxt_router_temp_conf_t *tmcf, in nxt_router_conf_send() argument
1347 nxt_port_socket_write(task, tmcf->port, type, -1, tmcf->stream, 0, NULL); in nxt_router_conf_send()
1349 nxt_port_use(task, tmcf->port, -1); in nxt_router_conf_send()
1534 nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf, in nxt_router_conf_create() argument
1583 nxt_alert(task, "configuration parsing error"); in nxt_router_conf_create()
1593 nxt_alert(task, "root map error"); in nxt_router_conf_create()
1603 ret = nxt_router_conf_process_static(task, rtcf, conf); in nxt_router_conf_create()
1622 nxt_debug(task, "application \"%V\"", &name); in nxt_router_conf_create()
1649 nxt_debug(task, "application conf \"%V\"", &app->conf); in nxt_router_conf_create()
1686 nxt_alert(task, "application map error"); in nxt_router_conf_create()
1693 nxt_alert(task, "application limits is not object"); in nxt_router_conf_create()
1702 nxt_alert(task, "application limits map error"); in nxt_router_conf_create()
1715 nxt_alert(task, "application processes map error"); in nxt_router_conf_create()
1748 nxt_debug(task, "application type: %V", &apcf.type); in nxt_router_conf_create()
1749 nxt_debug(task, "application processes: %D", apcf.processes); in nxt_router_conf_create()
1750 nxt_debug(task, "application request timeout: %M", apcf.timeout); in nxt_router_conf_create()
1752 lang = nxt_app_lang_module(task->thread->runtime, &apcf.type); in nxt_router_conf_create()
1755 nxt_alert(task, "unknown application type: \"%V\"", &apcf.type); in nxt_router_conf_create()
1759 nxt_debug(task, "application language module: \"%s\"", lang->file); in nxt_router_conf_create()
1784 engine = task->thread->engine; in nxt_router_conf_create()
1789 app->adjust_idle_work.task = &engine->task; in nxt_router_conf_create()
1799 nxt_router_app_use(task, app, 1); in nxt_router_conf_create()
1809 app_joint->idle_timer.task = &engine->task; in nxt_router_conf_create()
1810 app_joint->idle_timer.log = app_joint->idle_timer.task->log; in nxt_router_conf_create()
1813 app_joint->free_app_work.task = &engine->task; in nxt_router_conf_create()
1816 port = nxt_port_new(task, NXT_SHARED_PORT_ID, nxt_pid, in nxt_router_conf_create()
1822 ret = nxt_port_socket_init(task, port, 0); in nxt_router_conf_create()
1824 nxt_port_use(task, port, -1); in nxt_router_conf_create()
1828 ret = nxt_router_app_queue_init(task, port); in nxt_router_conf_create()
1832 nxt_port_use(task, port, -1); in nxt_router_conf_create()
1836 nxt_port_write_enable(task, port); in nxt_router_conf_create()
1847 routes = nxt_http_routes_create(task, tmcf, conf); in nxt_router_conf_create()
1855 ret = nxt_upstreams_create(task, tmcf, root); in nxt_router_conf_create()
1863 nxt_alert(task, "no \"http\" block"); in nxt_router_conf_create()
1881 skcf = nxt_router_socket_conf(task, tmcf, &name); in nxt_router_conf_create()
1892 nxt_alert(task, "listener map error"); in nxt_router_conf_create()
1896 nxt_debug(task, "application: %V", &lscf.application); in nxt_router_conf_create()
1927 nxt_alert(task, "http map error"); in nxt_router_conf_create()
1938 nxt_alert(task, "websocket map error"); in nxt_router_conf_create()
1946 t->start = (u_char *) task->thread->runtime->tmp; in nxt_router_conf_create()
1953 skcf->forwarded = nxt_router_conf_forward(task, mp, conf); in nxt_router_conf_create()
1962 skcf->client_ip = nxt_router_conf_forward(task, mp, conf); in nxt_router_conf_create()
2017 skcf->action = nxt_http_action_create(task, tmcf, &lscf.pass); in nxt_router_conf_create()
2021 skcf->action = nxt_http_pass_application(task, rtcf, in nxt_router_conf_create()
2031 ret = nxt_http_routes_resolve(task, tmcf); in nxt_router_conf_create()
2039 ret = nxt_router_access_log_create(task, rtcf, value); in nxt_router_conf_create()
2097 nxt_router_conf_process_static(nxt_task_t *task, nxt_router_conf_t *rtcf, in nxt_router_conf_process_static() argument
2178 nxt_router_conf_forward(nxt_task_t *task, nxt_mp_t *mp, nxt_conf_value_t *conf) in nxt_router_conf_forward() argument
2217 source = nxt_http_route_addr_rule_create(task, mp, source_conf); in nxt_router_conf_forward()
2297 nxt_router_app_queue_init(nxt_task_t *task, nxt_port_t *port) in nxt_router_app_queue_init() argument
2302 fd = nxt_shm_open(task, sizeof(nxt_app_queue_t)); in nxt_router_app_queue_init()
2325 nxt_router_port_queue_init(nxt_task_t *task, nxt_port_t *port) in nxt_router_port_queue_init() argument
2330 fd = nxt_shm_open(task, sizeof(nxt_port_queue_t)); in nxt_router_port_queue_init()
2353 nxt_router_port_queue_map(nxt_task_t *task, nxt_port_t *port, nxt_fd_t fd) in nxt_router_port_queue_map() argument
2436 nxt_router_apps_hash_use(nxt_task_t *task, nxt_router_conf_t *rtcf, int i) in nxt_router_apps_hash_use() argument
2450 nxt_router_app_use(task, app, i); in nxt_router_apps_hash_use()
2501 nxt_router_socket_conf(nxt_task_t *task, nxt_router_temp_conf_t *tmcf, in nxt_router_socket_conf() argument
2513 nxt_alert(task, "invalid listener \"%V\"", name); in nxt_router_socket_conf()
2519 nxt_debug(task, "router listener: \"%*s\"", in nxt_router_socket_conf()
2616 nxt_router_listen_socket_rpc_create(nxt_task_t *task, in nxt_router_listen_socket_rpc_create() argument
2646 rt = task->thread->runtime; in nxt_router_listen_socket_rpc_create()
2650 stream = nxt_port_rpc_register_handler(task, router_port, in nxt_router_listen_socket_rpc_create()
2658 ret = nxt_port_socket_write(task, main_port, NXT_PORT_MSG_SOCKET, -1, in nxt_router_listen_socket_rpc_create()
2662 nxt_port_rpc_cancel(task, router_port, stream); in nxt_router_listen_socket_rpc_create()
2670 nxt_router_conf_error(task, tmcf); in nxt_router_listen_socket_rpc_create()
2675 nxt_router_listen_socket_ready(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_listen_socket_ready() argument
2686 ret = nxt_socket_nonblocking(task, s); in nxt_router_listen_socket_ready()
2691 nxt_socket_defer_accept(task, s, rpc->socket_conf->listen->sockaddr); in nxt_router_listen_socket_ready()
2693 ret = nxt_listen_socket(task, s, NXT_LISTEN_BACKLOG); in nxt_router_listen_socket_ready()
2700 nxt_work_queue_add(&task->thread->engine->fast_work_queue, in nxt_router_listen_socket_ready()
2701 nxt_router_conf_apply, task, rpc->temp_conf, NULL); in nxt_router_listen_socket_ready()
2707 nxt_socket_close(task, s); in nxt_router_listen_socket_ready()
2709 nxt_router_conf_error(task, rpc->temp_conf); in nxt_router_listen_socket_ready()
2714 nxt_router_listen_socket_error(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_listen_socket_error() argument
2767 nxt_debug(task, "%*s", out->mem.free - out->mem.pos, out->mem.pos); in nxt_router_listen_socket_error()
2770 nxt_router_conf_error(task, tmcf); in nxt_router_listen_socket_error()
2777 nxt_router_tls_rpc_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_tls_rpc_handler() argument
2787 nxt_debug(task, "tls rpc handler"); in nxt_router_tls_rpc_handler()
2826 ret = task->thread->runtime->tls->server_init(task, mp, tls->tls_init, in nxt_router_tls_rpc_handler()
2832 nxt_work_queue_add(&task->thread->engine->fast_work_queue, in nxt_router_tls_rpc_handler()
2833 nxt_router_conf_apply, task, tmcf, NULL); in nxt_router_tls_rpc_handler()
2838 nxt_router_conf_error(task, tmcf); in nxt_router_tls_rpc_handler()
2845 nxt_router_app_rpc_create(nxt_task_t *task, in nxt_router_app_rpc_create() argument
2857 rt = task->thread->runtime; in nxt_router_app_rpc_create()
2862 nxt_debug(task, "app '%V' prototype prefork", &app->name); in nxt_router_app_rpc_create()
2883 nxt_debug(task, "app '%V' prefork", &app->name); in nxt_router_app_rpc_create()
2892 rpc = nxt_port_rpc_register_handler_ex(task, router_port, in nxt_router_app_rpc_create()
2906 ret = nxt_port_socket_write2(task, dport, NXT_PORT_MSG_START_PROCESS, in nxt_router_app_rpc_create()
2909 nxt_port_rpc_cancel(task, router_port, stream); in nxt_router_app_rpc_create()
2914 nxt_port_rpc_ex_set_peer(task, router_port, rpc, dport->pid); in nxt_router_app_rpc_create()
2923 nxt_router_conf_error(task, tmcf); in nxt_router_app_rpc_create()
2928 nxt_router_app_prefork_ready(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_app_prefork_ready() argument
2953 nxt_router_app_rpc_create(task, rpc->temp_conf, app); in nxt_router_app_prefork_ready()
2967 engine = task->thread->engine; in nxt_router_app_prefork_ready()
2972 nxt_debug(task, "app '%V' move new port %PI:%d to spare_ports", in nxt_router_app_prefork_ready()
2982 nxt_port_socket_write(task, port, NXT_PORT_MSG_PORT_ACK, -1, 0, 0, NULL); in nxt_router_app_prefork_ready()
2985 nxt_router_conf_apply, task, rpc->temp_conf, NULL); in nxt_router_app_prefork_ready()
2990 nxt_router_app_prefork_error(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_app_prefork_error() argument
3002 nxt_log(task, NXT_LOG_WARN, "failed to start prototype \"%V\"", in nxt_router_app_prefork_error()
3006 nxt_log(task, NXT_LOG_WARN, "failed to start application \"%V\"", in nxt_router_app_prefork_error()
3012 nxt_router_conf_error(task, tmcf); in nxt_router_app_prefork_error()
3017 nxt_router_engines_create(nxt_task_t *task, nxt_router_t *router, in nxt_router_engines_create() argument
3072 recf->engine = nxt_event_engine_create(task, interface, NULL, 0, 0); in nxt_router_engines_create()
3181 job->task = tmcf->engine->task; in nxt_router_engine_joints_create()
3183 job->work.task = &job->task; in nxt_router_engine_joints_create()
3229 job->task = tmcf->engine->task; in nxt_router_engine_quit()
3231 job->work.task = &job->task; in nxt_router_engine_quit()
3259 job->task = tmcf->engine->task; in nxt_router_engine_joints_delete()
3261 job->work.task = &job->task; in nxt_router_engine_joints_delete()
3274 nxt_router_threads_create(nxt_task_t *task, nxt_runtime_t *rt, in nxt_router_threads_create() argument
3285 ret = nxt_router_thread_create(task, rt, recf[i].engine); in nxt_router_threads_create()
3296 nxt_router_thread_create(nxt_task_t *task, nxt_runtime_t *rt, in nxt_router_thread_create() argument
3312 link->work.task = task; in nxt_router_thread_create()
3328 nxt_router_apps_sort(nxt_task_t *task, nxt_router_t *router, in nxt_router_apps_sort() argument
3335 nxt_router_app_unlink(task, app); in nxt_router_apps_sort()
3405 nxt_task_t *task; in nxt_router_thread_start() local
3413 task = &engine->task; in nxt_router_thread_start()
3420 thread->runtime = engine->task.thread->runtime; in nxt_router_thread_start()
3422 engine->task.thread = thread; in nxt_router_thread_start()
3423 engine->task.log = thread->log; in nxt_router_thread_start()
3425 thread->task = &engine->task; in nxt_router_thread_start()
3435 port = nxt_port_new(task, nxt_port_get_next_id(), nxt_pid, in nxt_router_thread_start()
3441 ret = nxt_port_socket_init(task, port, 0); in nxt_router_thread_start()
3443 nxt_port_use(task, port, -1); in nxt_router_thread_start()
3447 ret = nxt_router_port_queue_init(task, port); in nxt_router_thread_start()
3449 nxt_port_use(task, port, -1); in nxt_router_thread_start()
3455 nxt_port_enable(task, port, &nxt_router_app_port_handlers); in nxt_router_thread_start()
3463 work->task = link->work.task; in nxt_router_thread_start()
3467 nxt_event_engine_post(link->work.task->thread->engine, work); in nxt_router_thread_start()
3474 nxt_router_rt_add_port(nxt_task_t *task, void *obj, void *data) in nxt_router_rt_add_port() argument
3480 rt = task->thread->runtime; in nxt_router_rt_add_port()
3488 nxt_port_use(task, port, 1); in nxt_router_rt_add_port()
3494 nxt_router_listen_socket_create(nxt_task_t *task, void *obj, void *data) in nxt_router_listen_socket_create() argument
3506 nxt_queue_insert_tail(&task->thread->engine->joints, &joint->link); in nxt_router_listen_socket_create()
3511 lev = nxt_listen_event(task, ls); in nxt_router_listen_socket_create()
3513 nxt_router_listen_socket_release(task, skcf); in nxt_router_listen_socket_create()
3558 nxt_router_listen_socket_update(nxt_task_t *task, void *obj, void *data) in nxt_router_listen_socket_update() argument
3568 engine = task->thread->engine; in nxt_router_listen_socket_update()
3589 nxt_router_conf_release(&engine->task, old); in nxt_router_listen_socket_update()
3594 nxt_router_listen_socket_delete(nxt_task_t *task, void *obj, void *data) in nxt_router_listen_socket_delete() argument
3603 engine = task->thread->engine; in nxt_router_listen_socket_delete()
3609 nxt_debug(task, "engine %p: listen socket delete: %d", engine, in nxt_router_listen_socket_delete()
3623 nxt_router_worker_thread_quit(nxt_task_t *task, void *obj, void *data) in nxt_router_worker_thread_quit() argument
3627 nxt_debug(task, "router worker thread quit"); in nxt_router_worker_thread_quit()
3629 engine = task->thread->engine; in nxt_router_worker_thread_quit()
3634 nxt_thread_exit(task->thread); in nxt_router_worker_thread_quit()
3640 nxt_router_listen_socket_close(nxt_task_t *task, void *obj, void *data) in nxt_router_listen_socket_close() argument
3650 nxt_debug(task, "engine %p: listen socket close: %d", task->thread->engine, in nxt_router_listen_socket_close()
3659 task = &task->thread->engine->task; in nxt_router_listen_socket_close()
3661 nxt_router_listen_socket_release(task, joint->socket_conf); in nxt_router_listen_socket_close()
3669 nxt_router_listen_event_release(task, lev, joint); in nxt_router_listen_socket_close()
3674 nxt_router_listen_socket_release(nxt_task_t *task, nxt_socket_conf_t *skcf) in nxt_router_listen_socket_release() argument
3684 nxt_debug(task, "engine %p: listen socket release: ls->count %D", in nxt_router_listen_socket_release()
3685 task->thread->engine, ls->count); in nxt_router_listen_socket_release()
3694 nxt_socket_close(task, ls->socket); in nxt_router_listen_socket_release()
3701 nxt_router_listen_event_release(nxt_task_t *task, nxt_listen_event_t *lev, in nxt_router_listen_event_release() argument
3706 nxt_debug(task, "listen event count: %D", lev->count); in nxt_router_listen_event_release()
3708 engine = task->thread->engine; in nxt_router_listen_event_release()
3714 nxt_conn_free(task, lev->next); in nxt_router_listen_event_release()
3721 nxt_router_conf_release(task, joint); in nxt_router_listen_event_release()
3725 nxt_thread_exit(task->thread); in nxt_router_listen_event_release()
3731 nxt_router_conf_release(nxt_task_t *task, nxt_socket_conf_joint_t *joint) in nxt_router_conf_release() argument
3737 nxt_debug(task, "conf joint %p count: %D", joint, joint->count); in nxt_router_conf_release()
3756 nxt_debug(task, "conf skcf %p: %D, rtcf %p: %D", skcf, skcf->count, in nxt_router_conf_release()
3775 task->thread->runtime->tls->server_free(task, skcf->tls); in nxt_router_conf_release()
3782 nxt_debug(task, "old router conf is destroyed"); in nxt_router_conf_release()
3784 nxt_router_apps_hash_use(task, rtcf, -1); in nxt_router_conf_release()
3786 nxt_router_access_log_release(task, lock, rtcf->access_log); in nxt_router_conf_release()
3796 nxt_router_thread_exit_handler(nxt_task_t *task, void *obj, void *data) in nxt_router_thread_exit_handler() argument
3816 port->engine = task->thread->engine; in nxt_router_thread_exit_handler()
3818 nxt_port_use(task, port, -1); in nxt_router_thread_exit_handler()
3830 nxt_router_response_ready_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_response_ready_handler() argument
3852 nxt_request_rpc_data_unlink(task, req_rpc_data); in nxt_router_response_ready_handler()
3860 nxt_router_req_headers_ack_handler(task, msg, req_rpc_data); in nxt_router_response_ready_handler()
3868 nxt_debug(task, "router data create last buf"); in nxt_router_response_ready_handler()
3878 nxt_request_rpc_data_unlink(task, req_rpc_data); in nxt_router_response_ready_handler()
3884 nxt_timer_add(task->thread->engine, &r->timer, app->timeout); in nxt_router_response_ready_handler()
3899 nxt_http_request_send_body(task, r, NULL); in nxt_router_response_ready_handler()
3905 nxt_alert(task, "response buffer too small: %z", b_size); in nxt_router_response_ready_handler()
3914 nxt_alert(task, "response buffer too small for fields count: %D", in nxt_router_response_ready_handler()
3946 nxt_debug(task, "header%s: %*s: %*s", in nxt_router_response_ready_handler()
3970 nxt_work_queue_add(&task->thread->engine->fast_work_queue, in nxt_router_response_ready_handler()
3971 b->completion_handler, task, b, b->parent); in nxt_router_response_ready_handler()
3980 nxt_http_request_header_send(task, r, nxt_http_request_send_body, NULL); in nxt_router_response_ready_handler()
3996 nxt_router_app_port_release(task, app, app_port, NXT_APR_UPGRADE); in nxt_router_response_ready_handler()
3999 nxt_debug(task, "stream #%uD upgrade", req_rpc_data->stream); in nxt_router_response_ready_handler()
4012 nxt_http_request_error(task, r, NXT_HTTP_SERVICE_UNAVAILABLE); in nxt_router_response_ready_handler()
4014 nxt_request_rpc_data_unlink(task, req_rpc_data); in nxt_router_response_ready_handler()
4019 nxt_router_req_headers_ack_handler(nxt_task_t *task, in nxt_router_req_headers_ack_handler() argument
4030 nxt_debug(task, "stream #%uD: got ack from %PI:%d", in nxt_router_req_headers_ack_handler()
4034 nxt_port_rpc_ex_set_peer(task, msg->port, req_rpc_data, in nxt_router_req_headers_ack_handler()
4057 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); in nxt_router_req_headers_ack_handler()
4071 nxt_debug(task, "app '%V' move port %PI:%d out of %s (ack)", in nxt_router_req_headers_ack_handler()
4093 nxt_debug(task, "app '%V' move port %PI:%d from idle_ports " in nxt_router_req_headers_ack_handler()
4115 nxt_router_start_app_process(task, app); in nxt_router_req_headers_ack_handler()
4118 nxt_port_use(task, req_rpc_data->app_port, -1); in nxt_router_req_headers_ack_handler()
4132 nxt_debug(task, "stream #%uD: send body fd %d", req_rpc_data->stream, in nxt_router_req_headers_ack_handler()
4139 res = nxt_port_socket_write(task, app_port, NXT_PORT_MSG_REQ_BODY, in nxt_router_req_headers_ack_handler()
4142 task->thread->engine->port->id, b); in nxt_router_req_headers_ack_handler()
4145 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); in nxt_router_req_headers_ack_handler()
4152 nxt_timer_add(task->thread->engine, &r->timer, app->timeout); in nxt_router_req_headers_ack_handler()
4165 nxt_http_request_send_body(nxt_task_t *task, void *obj, void *data) in nxt_http_request_send_body() argument
4176 nxt_http_request_send(task, r, out); in nxt_http_request_send_body()
4182 nxt_router_response_error_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_response_error_handler() argument
4195 nxt_http_request_error(task, req_rpc_data->request, in nxt_router_response_error_handler()
4199 nxt_request_rpc_data_unlink(task, req_rpc_data); in nxt_router_response_error_handler()
4204 nxt_router_app_port_ready(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_app_port_ready() argument
4226 nxt_router_app_joint_use(task, app_joint, -1); in nxt_router_app_port_ready()
4229 nxt_debug(task, "new port ready for released app, send QUIT"); in nxt_router_app_port_ready()
4231 nxt_port_socket_write(task, port, NXT_PORT_MSG_QUIT, -1, 0, 0, NULL); in nxt_router_app_port_ready()
4250 nxt_debug(task, "proto port ready for restarted app, send QUIT"); in nxt_router_app_port_ready()
4252 nxt_port_socket_write(task, port, NXT_PORT_MSG_QUIT, -1, 0, 0, in nxt_router_app_port_ready()
4261 nxt_port_use(task, port, 1); in nxt_router_app_port_ready()
4264 port = task->thread->runtime->port_by_type[NXT_PROCESS_ROUTER]; in nxt_router_app_port_ready()
4267 nxt_router_app_use(task, app, 1); in nxt_router_app_port_ready()
4269 nxt_router_start_app_process_handler(task, port, app); in nxt_router_app_port_ready()
4283 nxt_debug(task, "new port ready for restarted app, send QUIT"); in nxt_router_app_port_ready()
4285 start_process = !task->thread->engine->shutdown in nxt_router_app_port_ready()
4295 nxt_port_socket_write(task, port, NXT_PORT_MSG_QUIT, -1, 0, 0, NULL); in nxt_router_app_port_ready()
4298 nxt_router_start_app_process(task, app); in nxt_router_app_port_ready()
4313 nxt_debug(task, "app '%V' new port ready, pid %PI, %d/%d", in nxt_router_app_port_ready()
4316 nxt_port_socket_write(task, port, NXT_PORT_MSG_PORT_ACK, -1, 0, 0, NULL); in nxt_router_app_port_ready()
4318 nxt_router_app_port_release(task, app, port, NXT_APR_NEW_PORT); in nxt_router_app_port_ready()
4323 nxt_router_app_port_error(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_router_app_port_error() argument
4341 nxt_router_app_joint_use(task, app_joint, -1); in nxt_router_app_port_error()
4344 nxt_debug(task, "start error for released app"); in nxt_router_app_port_error()
4349 nxt_debug(task, "app '%V' %p start error", &app->name, app); in nxt_router_app_port_error()
4392 nxt_router_app_get_port_for_quit(nxt_task_t *task, nxt_app_t *app) in nxt_router_app_get_port_for_quit() argument
4408 nxt_debug(task, "app '%V' move port %PI:%d out of %s for quit", in nxt_router_app_get_port_for_quit()
4430 nxt_router_app_use(nxt_task_t *task, nxt_app_t *app, int i) in nxt_router_app_use() argument
4438 if (task->thread->engine != app->engine) { in nxt_router_app_use()
4442 nxt_router_free_app(task, app->joint, NULL); in nxt_router_app_use()
4449 nxt_router_app_unlink(nxt_task_t *task, nxt_app_t *app) in nxt_router_app_unlink() argument
4451 nxt_debug(task, "app '%V' %p unlink", &app->name, app); in nxt_router_app_unlink()
4455 nxt_router_app_use(task, app, -1); in nxt_router_app_unlink()
4460 nxt_router_app_port_release(nxt_task_t *task, nxt_app_t *app, nxt_port_t *port, in nxt_router_app_port_release() argument
4493 nxt_debug(task, "app '%V' release port %PI:%d: %d %d", &app->name, in nxt_router_app_port_release()
4538 nxt_debug(task, "app '%V' move port %PI:%d to spare_ports", in nxt_router_app_port_release()
4543 main_app_port->idle_start = task->thread->engine->timers.now; in nxt_router_app_port_release()
4545 nxt_debug(task, "app '%V' move port %PI:%d to idle_ports", in nxt_router_app_port_release()
4555 nxt_router_app_use(task, app, 1); in nxt_router_app_port_release()
4561 nxt_debug(task, "app '%V' %p port %p already closed (pid %PI dead?)", in nxt_router_app_port_release()
4567 nxt_debug(task, "app '%V' %p requests queue is empty, keep the port", in nxt_router_app_port_release()
4572 nxt_port_use(task, port, inc_use); in nxt_router_app_port_release()
4577 nxt_router_app_port_close(nxt_task_t *task, nxt_port_t *port) in nxt_router_app_port_close() argument
4596 nxt_debug(task, "app '%V' prototype pid %PI closed", &app->name, in nxt_router_app_port_close()
4599 nxt_port_use(task, port, -1); in nxt_router_app_port_close()
4610 nxt_debug(task, "app '%V' port (%PI, %d) closed", &app->name, in nxt_router_app_port_close()
4621 nxt_debug(task, "app '%V' move port %PI:%d out of %s before close", in nxt_router_app_port_close()
4638 nxt_debug(task, "app '%V' move port %PI:%d from idle_ports " in nxt_router_app_port_close()
4646 start_process = !task->thread->engine->shutdown in nxt_router_app_port_close()
4656 nxt_debug(task, "app '%V' pid %PI closed", &app->name, port->pid); in nxt_router_app_port_close()
4659 nxt_port_use(task, port, -1); in nxt_router_app_port_close()
4663 nxt_router_start_app_process(task, app); in nxt_router_app_port_close()
4669 nxt_router_adjust_idle_timer(nxt_task_t *task, void *obj, void *data) in nxt_router_adjust_idle_timer() argument
4681 nxt_debug(task, "nxt_router_adjust_idle_timer: app \"%V\", queued %b", in nxt_router_adjust_idle_timer()
4684 engine = task->thread->engine; in nxt_router_adjust_idle_timer()
4697 nxt_debug(task, "app '%V' idle_processes %d, spare_processes %d", in nxt_router_adjust_idle_timer()
4710 nxt_debug(task, "app '%V' pid %PI, start %M, timeout %M, threshold %M", in nxt_router_adjust_idle_timer()
4721 nxt_debug(task, "app '%V' move port %PI:%d out of idle_ports (timeout)", in nxt_router_adjust_idle_timer()
4735 nxt_debug(task, "app '%V' send QUIT to idle port %PI", in nxt_router_adjust_idle_timer()
4738 nxt_port_socket_write(task, port, NXT_PORT_MSG_QUIT, -1, 0, 0, NULL); in nxt_router_adjust_idle_timer()
4740 nxt_port_use(task, port, -1); in nxt_router_adjust_idle_timer()
4755 nxt_router_app_use(task, app, -1); in nxt_router_adjust_idle_timer()
4761 nxt_router_app_idle_timeout(nxt_task_t *task, void *obj, void *data) in nxt_router_app_idle_timeout() argument
4770 nxt_router_adjust_idle_timer(task, app_joint->app, NULL); in nxt_router_app_idle_timeout()
4776 nxt_router_app_joint_release_handler(nxt_task_t *task, void *obj, void *data) in nxt_router_app_joint_release_handler() argument
4784 nxt_router_app_joint_use(task, app_joint, -1); in nxt_router_app_joint_release_handler()
4789 nxt_router_free_app(nxt_task_t *task, void *obj, void *data) in nxt_router_free_app() argument
4799 port = nxt_router_app_get_port_for_quit(task, app); in nxt_router_free_app()
4804 nxt_port_use(task, port, -1); in nxt_router_free_app()
4819 nxt_port_close(task, port); in nxt_router_free_app()
4821 nxt_port_use(task, port, -1); in nxt_router_free_app()
4827 nxt_debug(task, "send QUIT to prototype '%V' pid %PI", &app->name, in nxt_router_free_app()
4837 nxt_port_socket_write(task, proto_port, NXT_PORT_MSG_QUIT, in nxt_router_free_app()
4840 nxt_port_close(task, proto_port); in nxt_router_free_app()
4842 nxt_port_use(task, proto_port, -1); in nxt_router_free_app()
4860 nxt_port_close(task, app->shared_port); in nxt_router_free_app()
4861 nxt_port_use(task, app->shared_port, -1); in nxt_router_free_app()
4871 if (nxt_timer_delete(task->thread->engine, &app_joint->idle_timer)) { in nxt_router_free_app()
4873 nxt_timer_add(task->thread->engine, &app_joint->idle_timer, 0); in nxt_router_free_app()
4876 nxt_router_app_joint_use(task, app_joint, -1); in nxt_router_free_app()
4882 nxt_router_app_port_get(nxt_task_t *task, nxt_app_t *app, in nxt_router_app_port_get() argument
4923 nxt_router_start_app_process(task, app); in nxt_router_app_port_get()
4929 nxt_router_process_http_request(nxt_task_t *task, nxt_http_request_t *r, in nxt_router_process_http_request() argument
4937 engine = task->thread->engine; in nxt_router_process_http_request()
4941 req_rpc_data = nxt_port_rpc_register_handler_ex(task, engine->port, in nxt_router_process_http_request()
4946 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR); in nxt_router_process_http_request()
4960 r->timer.task = &engine->task; in nxt_router_process_http_request()
4962 r->timer.log = engine->task.log; in nxt_router_process_http_request()
4967 r->err_work.task = task; in nxt_router_process_http_request()
4975 nxt_router_app_use(task, conf->app, 1); in nxt_router_process_http_request()
4984 nxt_router_app_port_get(task, conf->app, req_rpc_data); in nxt_router_process_http_request()
4985 nxt_router_app_prepare_request(task, req_rpc_data); in nxt_router_process_http_request()
4990 nxt_router_http_request_error(nxt_task_t *task, void *obj, void *data) in nxt_router_http_request_error() argument
4996 nxt_debug(task, "router http request error (rpc_data %p)", r->req_rpc_data); in nxt_router_http_request_error()
4998 nxt_http_request_error(task, r, NXT_HTTP_SERVICE_UNAVAILABLE); in nxt_router_http_request_error()
5001 nxt_request_rpc_data_unlink(task, r->req_rpc_data); in nxt_router_http_request_error()
5009 nxt_router_http_request_done(nxt_task_t *task, void *obj, void *data) in nxt_router_http_request_done() argument
5015 nxt_debug(task, "router http request done (rpc_data %p)", r->req_rpc_data); in nxt_router_http_request_done()
5018 nxt_request_rpc_data_unlink(task, r->req_rpc_data); in nxt_router_http_request_done()
5021 nxt_http_request_close_handler(task, r, r->proto.any); in nxt_router_http_request_done()
5026 nxt_router_app_prepare_request(nxt_task_t *task, in nxt_router_app_prepare_request() argument
5050 reply_port = task->thread->engine->port; in nxt_router_app_prepare_request()
5052 buf = nxt_router_prepare_msg(task, req_rpc_data->request, app, in nxt_router_app_prepare_request()
5055 nxt_alert(task, "stream #%uD, app '%V': failed to prepare app message", in nxt_router_app_prepare_request()
5058 nxt_http_request_error(task, req_rpc_data->request, in nxt_router_app_prepare_request()
5064 nxt_debug(task, "about to send %O bytes buffer to app process port %d", in nxt_router_app_prepare_request()
5102 (void) nxt_port_socket_write(task, port, in nxt_router_app_prepare_request()
5108 nxt_debug(task, "queue is not empty"); in nxt_router_app_prepare_request()
5115 nxt_alert(task, "stream #%uD, app '%V': failed to send app message", in nxt_router_app_prepare_request()
5118 nxt_http_request_error(task, req_rpc_data->request, in nxt_router_app_prepare_request()
5177 nxt_router_prepare_msg(nxt_task_t *task, nxt_http_request_t *r, in nxt_router_prepare_msg() argument
5213 nxt_alert(task, "headers to big to fit in shared memory (%d)", in nxt_router_prepare_msg()
5219 out = nxt_port_mmap_get_buf(task, &app->outgoing, in nxt_router_prepare_msg()
5234 nxt_debug(task, "fields_count=%d", (int) fields_count); in nxt_router_prepare_msg()
5331 nxt_debug(task, "add field 0x%04Xd, %d, %d, %p : %d %p", in nxt_router_prepare_msg()
5411 buf = nxt_port_mmap_get_buf(task, &app->outgoing, free_size); in nxt_router_prepare_msg()
5416 out->completion_handler(task, out, out->parent); in nxt_router_prepare_msg()
5428 && nxt_port_mmap_increase_buf(task, buf, size, 1) in nxt_router_prepare_msg()
5457 nxt_router_app_timeout(nxt_task_t *task, void *obj, void *data) in nxt_router_app_timeout() argument
5465 nxt_debug(task, "router app timeout"); in nxt_router_app_timeout()
5470 nxt_http_request_error(task, r, NXT_HTTP_SERVICE_UNAVAILABLE); in nxt_router_app_timeout()
5472 nxt_request_rpc_data_unlink(task, req_rpc_data); in nxt_router_app_timeout()
5477 nxt_router_http_request_release_post(nxt_task_t *task, nxt_http_request_t *r) in nxt_router_http_request_release_post() argument
5480 nxt_timer_add(task->thread->engine, &r->timer, 0); in nxt_router_http_request_release_post()
5485 nxt_router_http_request_release(nxt_task_t *task, void *obj, void *data) in nxt_router_http_request_release() argument
5489 nxt_debug(task, "http request pool release"); in nxt_router_http_request_release()
5498 nxt_router_oosm_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_router_oosm_handler() argument
5507 nxt_debug(task, "oosm in %PI", msg->port_msg.pid); in nxt_router_oosm_handler()
5509 process = nxt_runtime_process_find(task->thread->runtime, in nxt_router_oosm_handler()
5538 nxt_debug(task, "oosm: already free #%uD %uz = 0x%08xA", in nxt_router_oosm_handler()
5549 nxt_process_broadcast_shm_ack(task, process); in nxt_router_oosm_handler()
5555 nxt_router_get_mmap_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_router_get_mmap_handler() argument
5564 rt = task->thread->runtime; in nxt_router_get_mmap_handler()
5569 nxt_alert(task, "get_mmap_handler: reply_port %PI:%d not found", in nxt_router_get_mmap_handler()
5578 nxt_alert(task, "get_mmap_handler: message buffer too small (%d)", in nxt_router_get_mmap_handler()
5589 nxt_alert(task, "get_mmap_handler: app == NULL for reply port %PI:%d", in nxt_router_get_mmap_handler()
5593 nxt_port_socket_write(task, port, NXT_PORT_MSG_RPC_ERROR, in nxt_router_get_mmap_handler()
5605 nxt_alert(task, "get_mmap_handler: mmap id is too big (%d)", in nxt_router_get_mmap_handler()
5609 nxt_port_socket_write(task, port, NXT_PORT_MSG_RPC_ERROR, in nxt_router_get_mmap_handler()
5620 nxt_debug(task, "get mmap %PI:%d found", in nxt_router_get_mmap_handler()
5623 (void) nxt_port_socket_write(task, port, NXT_PORT_MSG_MMAP, fd, 0, 0, NULL); in nxt_router_get_mmap_handler()
5628 nxt_router_get_port_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_router_get_port_handler() argument
5634 rt = task->thread->runtime; in nxt_router_get_port_handler()
5639 nxt_alert(task, "get_port_handler: reply_port %PI:%d not found", in nxt_router_get_port_handler()
5648 nxt_alert(task, "get_port_handler: message buffer too small (%d)", in nxt_router_get_port_handler()
5658 nxt_alert(task, "get_port_handler: port %PI:%d not found", in nxt_router_get_port_handler()
5664 nxt_debug(task, "get port %PI:%d found", get_port_msg->pid, in nxt_router_get_port_handler()
5667 (void) nxt_port_send_port(task, reply_port, port, msg->port_msg.stream); in nxt_router_get_port_handler()