Lines Matching refs:task

43 static nxt_int_t nxt_controller_prefork(nxt_task_t *task,
45 static nxt_int_t nxt_controller_file_read(nxt_task_t *task, const char *name,
47 static nxt_int_t nxt_controller_start(nxt_task_t *task,
49 static void nxt_controller_process_new_port_handler(nxt_task_t *task,
51 static void nxt_controller_send_current_conf(nxt_task_t *task);
52 static void nxt_controller_router_ready_handler(nxt_task_t *task,
54 static void nxt_controller_remove_pid_handler(nxt_task_t *task,
57 static void nxt_controller_conf_init_handler(nxt_task_t *task,
59 static void nxt_controller_flush_requests(nxt_task_t *task);
60 static nxt_int_t nxt_controller_conf_send(nxt_task_t *task, nxt_mp_t *mp,
63 static void nxt_controller_conn_init(nxt_task_t *task, void *obj, void *data);
64 static void nxt_controller_conn_read(nxt_task_t *task, void *obj, void *data);
67 static void nxt_controller_conn_read_error(nxt_task_t *task, void *obj,
69 static void nxt_controller_conn_read_timeout(nxt_task_t *task, void *obj,
71 static void nxt_controller_conn_body_read(nxt_task_t *task, void *obj,
73 static void nxt_controller_conn_write(nxt_task_t *task, void *obj, void *data);
74 static void nxt_controller_conn_write_error(nxt_task_t *task, void *obj,
76 static void nxt_controller_conn_write_timeout(nxt_task_t *task, void *obj,
78 static void nxt_controller_conn_close(nxt_task_t *task, void *obj, void *data);
79 static void nxt_controller_conn_free(nxt_task_t *task, void *obj, void *data);
84 static void nxt_controller_process_request(nxt_task_t *task,
86 static void nxt_controller_process_config(nxt_task_t *task,
88 static nxt_bool_t nxt_controller_check_postpone_request(nxt_task_t *task);
89 static void nxt_controller_process_status(nxt_task_t *task,
91 static void nxt_controller_status_handler(nxt_task_t *task,
93 static void nxt_controller_status_response(nxt_task_t *task,
96 static void nxt_controller_process_cert(nxt_task_t *task,
98 static void nxt_controller_process_cert_save(nxt_task_t *task,
101 static void nxt_controller_cert_cleanup(nxt_task_t *task, void *obj,
104 static void nxt_controller_process_control(nxt_task_t *task,
106 static void nxt_controller_app_restart_handler(nxt_task_t *task,
108 static void nxt_controller_conf_handler(nxt_task_t *task,
110 static void nxt_controller_conf_store(nxt_task_t *task,
112 static void nxt_controller_response(nxt_task_t *task,
165 nxt_controller_prefork(nxt_task_t *task, nxt_process_t *process, nxt_mp_t *mp) in nxt_controller_prefork() argument
172 nxt_log(task, NXT_LOG_INFO, "controller started"); in nxt_controller_prefork()
174 rt = task->thread->runtime; in nxt_controller_prefork()
184 ret = nxt_controller_file_read(task, rt->conf, &ctrl_init.conf, mp); in nxt_controller_prefork()
190 ret = nxt_controller_file_read(task, rt->ver, &ver, mp); in nxt_controller_prefork()
199 nxt_alert(task, "failed to restore previous configuration: " in nxt_controller_prefork()
211 ctrl_init.certs = nxt_cert_store_load(task, mp); in nxt_controller_prefork()
213 nxt_mp_cleanup(mp, nxt_controller_cert_cleanup, task, ctrl_init.certs, rt); in nxt_controller_prefork()
223 nxt_controller_file_read(nxt_task_t *task, const char *name, nxt_str_t *str, in nxt_controller_file_read() argument
235 ret = nxt_file_open(task, &file, NXT_FILE_RDONLY, NXT_FILE_OPEN, 0); in nxt_controller_file_read()
255 nxt_file_close(task, &file); in nxt_controller_file_read()
260 nxt_file_close(task, &file); in nxt_controller_file_read()
267 nxt_file_close(task, &file); in nxt_controller_file_read()
276 nxt_controller_cert_cleanup(nxt_task_t *task, void *obj, void *data) in nxt_controller_cert_cleanup() argument
296 nxt_controller_start(nxt_task_t *task, nxt_process_data_t *data) in nxt_controller_start() argument
319 nxt_cert_info_init(task, init->certs); in nxt_controller_start()
337 nxt_alert(task, "failed to restore previous configuration: " in nxt_controller_start()
361 nxt_alert(task, "the previous configuration is invalid: %V", in nxt_controller_start()
385 nxt_controller_process_new_port_handler(nxt_task_t *task, in nxt_controller_process_new_port_handler() argument
388 nxt_port_new_port_handler(task, msg); in nxt_controller_process_new_port_handler()
396 nxt_controller_send_current_conf(task); in nxt_controller_process_new_port_handler()
401 nxt_controller_send_current_conf(nxt_task_t *task) in nxt_controller_send_current_conf() argument
410 rc = nxt_controller_conf_send(task, nxt_controller_conf.pool, conf, in nxt_controller_send_current_conf()
430 rt = task->thread->runtime; in nxt_controller_send_current_conf()
432 if (nxt_slow_path(nxt_listen_event(task, rt->controller_socket) == NULL)) { in nxt_controller_send_current_conf()
438 nxt_controller_flush_requests(task); in nxt_controller_send_current_conf()
443 nxt_controller_router_ready_handler(nxt_task_t *task, in nxt_controller_router_ready_handler() argument
449 rt = task->thread->runtime; in nxt_controller_router_ready_handler()
456 nxt_controller_send_current_conf(task); in nxt_controller_router_ready_handler()
462 nxt_controller_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) in nxt_controller_remove_pid_handler() argument
468 rt = task->thread->runtime; in nxt_controller_remove_pid_handler()
479 nxt_port_remove_pid_handler(task, msg); in nxt_controller_remove_pid_handler()
512 nxt_controller_conf_init_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_controller_conf_init_handler() argument
520 nxt_alert(task, "failed to apply previous configuration"); in nxt_controller_conf_init_handler()
530 rt = task->thread->runtime; in nxt_controller_conf_init_handler()
532 if (nxt_slow_path(nxt_listen_event(task, rt->controller_socket) in nxt_controller_conf_init_handler()
541 nxt_controller_flush_requests(task); in nxt_controller_conf_init_handler()
546 nxt_controller_flush_requests(nxt_task_t *task) in nxt_controller_flush_requests() argument
557 nxt_controller_process_request(task, req); in nxt_controller_flush_requests()
563 nxt_controller_conf_send(nxt_task_t *task, nxt_mp_t *mp, nxt_conf_value_t *conf, in nxt_controller_conf_send() argument
576 rt = task->thread->runtime; in nxt_controller_conf_send()
592 fd = nxt_shm_open(task, size); in nxt_controller_conf_send()
610 stream = nxt_port_rpc_register_handler(task, controller_port, in nxt_controller_conf_send()
617 rc = nxt_port_socket_write(task, router_port, in nxt_controller_conf_send()
622 nxt_port_rpc_cancel(task, controller_port, stream); in nxt_controller_conf_send()
638 nxt_runtime_controller_socket(nxt_task_t *task, nxt_runtime_t *rt) in nxt_runtime_controller_socket() argument
677 if (nxt_listen_socket_create(task, rt->mem_pool, ls) != NXT_OK) { in nxt_runtime_controller_socket()
688 nxt_controller_conn_init(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_init() argument
697 nxt_debug(task, "controller conn init fd:%d", c->socket.fd); in nxt_controller_conn_init()
701 nxt_controller_conn_free(task, c, NULL); in nxt_controller_conn_init()
710 nxt_controller_conn_free(task, c, NULL); in nxt_controller_conn_init()
718 nxt_controller_conn_free(task, c, NULL); in nxt_controller_conn_init()
727 engine = task->thread->engine; in nxt_controller_conn_init()
749 nxt_controller_conn_read(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_read() argument
760 nxt_debug(task, "controller conn read"); in nxt_controller_conn_read()
773 nxt_log(task, NXT_LOG_ERR, "too long request headers"); in nxt_controller_conn_read()
774 nxt_controller_conn_close(task, c, r); in nxt_controller_conn_read()
778 nxt_conn_read(task->thread->engine, c); in nxt_controller_conn_read()
784 nxt_log(task, NXT_LOG_ERR, "parsing error"); in nxt_controller_conn_read()
786 nxt_controller_conn_close(task, c, r); in nxt_controller_conn_read()
794 nxt_controller_conn_close(task, c, r); in nxt_controller_conn_read()
800 nxt_debug(task, "controller request header parsing complete, " in nxt_controller_conn_read()
805 nxt_controller_process_request(task, r); in nxt_controller_conn_read()
812 nxt_controller_conn_free(task, c, NULL); in nxt_controller_conn_read()
823 nxt_conn_read(task->thread->engine, c); in nxt_controller_conn_read()
835 nxt_controller_conn_read_error(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_read_error() argument
841 nxt_debug(task, "controller conn read error"); in nxt_controller_conn_read_error()
843 nxt_controller_conn_close(task, c, data); in nxt_controller_conn_read_error()
848 nxt_controller_conn_read_timeout(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_read_timeout() argument
859 nxt_debug(task, "controller conn read timeout"); in nxt_controller_conn_read_timeout()
861 nxt_controller_conn_close(task, c, data); in nxt_controller_conn_read_timeout()
880 nxt_controller_conn_body_read(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_body_read() argument
893 nxt_debug(task, "controller conn body read: %uz of %uz", in nxt_controller_conn_body_read()
897 nxt_controller_process_request(task, r); in nxt_controller_conn_body_read()
901 nxt_conn_read(task->thread->engine, c); in nxt_controller_conn_body_read()
919 nxt_controller_conn_write(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_write() argument
926 nxt_debug(task, "controller conn write"); in nxt_controller_conn_write()
931 nxt_conn_write(task->thread->engine, c); in nxt_controller_conn_write()
935 nxt_debug(task, "controller conn write complete"); in nxt_controller_conn_write()
937 nxt_controller_conn_close(task, c, data); in nxt_controller_conn_write()
942 nxt_controller_conn_write_error(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_write_error() argument
948 nxt_debug(task, "controller conn write error"); in nxt_controller_conn_write_error()
950 nxt_controller_conn_close(task, c, data); in nxt_controller_conn_write_error()
955 nxt_controller_conn_write_timeout(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_write_timeout() argument
966 nxt_debug(task, "controller conn write timeout"); in nxt_controller_conn_write_timeout()
968 nxt_controller_conn_close(task, c, data); in nxt_controller_conn_write_timeout()
980 nxt_controller_conn_close(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_close() argument
986 nxt_debug(task, "controller conn close"); in nxt_controller_conn_close()
992 nxt_conn_close(task->thread->engine, c); in nxt_controller_conn_close()
997 nxt_controller_conn_free(nxt_task_t *task, void *obj, void *data) in nxt_controller_conn_free() argument
1003 nxt_debug(task, "controller conn free"); in nxt_controller_conn_free()
1005 nxt_sockaddr_cache_free(task->thread->engine, c); in nxt_controller_conn_free()
1007 nxt_conn_free(task, c); in nxt_controller_conn_free()
1041 nxt_controller_process_request(nxt_task_t *task, nxt_controller_request_t *req) in nxt_controller_process_request() argument
1074 nxt_controller_process_config(task, req, &path); in nxt_controller_process_request()
1088 nxt_controller_process_status(task, req); in nxt_controller_process_request()
1100 nxt_controller_status_response(task, req, &path); in nxt_controller_process_request()
1117 nxt_controller_process_cert(task, req, &path); in nxt_controller_process_request()
1127 nxt_controller_process_control(task, req, &path); in nxt_controller_process_request()
1138 nxt_controller_process_status(task, req); in nxt_controller_process_request()
1169 nxt_controller_response(task, req, &resp); in nxt_controller_process_request()
1177 nxt_controller_response(task, req, &resp); in nxt_controller_process_request()
1186 nxt_controller_response(task, req, &resp); in nxt_controller_process_request()
1195 nxt_controller_response(task, req, &resp); in nxt_controller_process_request()
1201 nxt_controller_process_config(nxt_task_t *task, nxt_controller_request_t *req, in nxt_controller_process_config() argument
1232 nxt_controller_response(task, req, &resp); in nxt_controller_process_config()
1249 if (nxt_controller_check_postpone_request(task)) { in nxt_controller_process_config()
1289 nxt_controller_response(task, req, &resp); in nxt_controller_process_config()
1342 rc = nxt_controller_conf_send(task, mp, value, in nxt_controller_process_config()
1362 if (nxt_controller_check_postpone_request(task)) { in nxt_controller_process_config()
1425 rc = nxt_controller_conf_send(task, mp, value, in nxt_controller_process_config()
1449 nxt_controller_response(task, req, &resp); in nxt_controller_process_config()
1458 nxt_controller_response(task, req, &resp); in nxt_controller_process_config()
1467 nxt_controller_response(task, req, &resp); in nxt_controller_process_config()
1476 nxt_controller_response(task, req, &resp); in nxt_controller_process_config()
1481 nxt_controller_check_postpone_request(nxt_task_t *task) in nxt_controller_check_postpone_request() argument
1493 rt = task->thread->runtime; in nxt_controller_check_postpone_request()
1502 nxt_controller_process_status(nxt_task_t *task, nxt_controller_request_t *req) in nxt_controller_process_status() argument
1510 if (nxt_controller_check_postpone_request(task)) { in nxt_controller_process_status()
1515 rt = task->thread->runtime; in nxt_controller_process_status()
1524 stream = nxt_port_rpc_register_handler(task, controller_port, in nxt_controller_process_status()
1532 rc = nxt_port_socket_write(task, router_port, NXT_PORT_MSG_STATUS, in nxt_controller_process_status()
1536 nxt_port_rpc_cancel(task, controller_port, stream); in nxt_controller_process_status()
1552 nxt_controller_response(task, req, &resp); in nxt_controller_process_status()
1558 nxt_controller_status_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_controller_status_handler() argument
1565 nxt_debug(task, "controller status handler"); in nxt_controller_status_handler()
1585 nxt_controller_response(task, req, &resp); in nxt_controller_status_handler()
1590 nxt_controller_flush_requests(task); in nxt_controller_status_handler()
1597 nxt_controller_status_response(nxt_task_t *task, nxt_controller_request_t *req, in nxt_controller_status_response() argument
1612 nxt_controller_response(task, req, &resp); in nxt_controller_status_response()
1619 nxt_controller_response(task, req, &resp); in nxt_controller_status_response()
1626 nxt_controller_process_cert(nxt_task_t *task, in nxt_controller_process_cert() argument
1681 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1695 cert = nxt_cert_mem(task, &c->read->mem); in nxt_controller_process_cert()
1708 nxt_cert_store_get(task, &name, c->mem_pool, in nxt_controller_process_cert()
1723 nxt_cert_store_delete(task, &name, c->mem_pool); in nxt_controller_process_cert()
1728 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1736 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1745 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1754 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1763 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1772 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1781 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1790 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1799 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert()
1805 nxt_controller_process_cert_save(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_controller_process_cert_save() argument
1821 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert_save()
1838 nxt_controller_response(task, req, &resp); in nxt_controller_process_cert_save()
1883 nxt_controller_conf_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_controller_conf_handler() argument
1891 nxt_debug(task, "controller conf ready: %*s", in nxt_controller_conf_handler()
1903 nxt_controller_conf_store(task, req->conf.root); in nxt_controller_conf_handler()
1916 nxt_controller_response(task, req, &resp); in nxt_controller_conf_handler()
1918 nxt_controller_flush_requests(task); in nxt_controller_conf_handler()
1923 nxt_controller_process_control(nxt_task_t *task, in nxt_controller_process_control() argument
1951 if (nxt_controller_check_postpone_request(task)) { in nxt_controller_process_control()
1978 rt = task->thread->runtime; in nxt_controller_process_control()
1983 stream = nxt_port_rpc_register_handler(task, controller_port, in nxt_controller_process_control()
1991 rc = nxt_port_socket_write(task, router_port, NXT_PORT_MSG_APP_RESTART, in nxt_controller_process_control()
1994 nxt_port_rpc_cancel(task, controller_port, stream); in nxt_controller_process_control()
2009 nxt_controller_response(task, req, &resp); in nxt_controller_process_control()
2018 nxt_controller_response(task, req, &resp); in nxt_controller_process_control()
2027 nxt_controller_response(task, req, &resp); in nxt_controller_process_control()
2036 nxt_controller_response(task, req, &resp); in nxt_controller_process_control()
2041 nxt_controller_app_restart_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg, in nxt_controller_app_restart_handler() argument
2049 nxt_debug(task, "controller app restart handler"); in nxt_controller_app_restart_handler()
2065 nxt_controller_response(task, req, &resp); in nxt_controller_app_restart_handler()
2067 nxt_controller_flush_requests(task); in nxt_controller_app_restart_handler()
2072 nxt_controller_conf_store(nxt_task_t *task, nxt_conf_value_t *conf) in nxt_controller_conf_store() argument
2082 rt = task->thread->runtime; in nxt_controller_conf_store()
2088 fd = nxt_shm_open(task, size); in nxt_controller_conf_store()
2104 b = nxt_buf_mem_alloc(task->thread->engine->mem_pool, sizeof(size_t), 0); in nxt_controller_conf_store()
2111 (void) nxt_port_socket_write(task, main_port, in nxt_controller_conf_store()
2124 nxt_controller_response(nxt_task_t *task, nxt_controller_request_t *req, in nxt_controller_response() argument
2186 nxt_controller_conn_close(task, c, req); in nxt_controller_response()
2234 nxt_controller_conn_close(task, c, req); in nxt_controller_response()
2254 nxt_controller_conn_close(task, c, req); in nxt_controller_response()
2272 b->mem.free = nxt_thread_time_string(task->thread, &date_cache, in nxt_controller_response()
2293 nxt_conn_write(task->thread->engine, c); in nxt_controller_response()