120Sigor@sysoev.ru 220Sigor@sysoev.ru /* 320Sigor@sysoev.ru * Copyright (C) Igor Sysoev 420Sigor@sysoev.ru * Copyright (C) Valentin V. Bartenev 520Sigor@sysoev.ru * Copyright (C) NGINX, Inc. 620Sigor@sysoev.ru */ 720Sigor@sysoev.ru 853Sigor@sysoev.ru #include <nxt_router.h> 9115Sigor@sysoev.ru #include <nxt_conf.h> 10774Svbart@nginx.com #if (NXT_TLS) 11774Svbart@nginx.com #include <nxt_cert.h> 12774Svbart@nginx.com #endif 13431Sigor@sysoev.ru #include <nxt_http.h> 14743Smax.romanov@nginx.com #include <nxt_port_memory_int.h> 15743Smax.romanov@nginx.com #include <nxt_unit_request.h> 16743Smax.romanov@nginx.com #include <nxt_unit_response.h> 171131Smax.romanov@nginx.com #include <nxt_router_request.h> 1820Sigor@sysoev.ru 19115Sigor@sysoev.ru typedef struct { 20318Smax.romanov@nginx.com nxt_str_t type; 21507Smax.romanov@nginx.com uint32_t processes; 22507Smax.romanov@nginx.com uint32_t max_processes; 23507Smax.romanov@nginx.com uint32_t spare_processes; 24318Smax.romanov@nginx.com nxt_msec_t timeout; 25427Smax.romanov@nginx.com nxt_msec_t res_timeout; 26507Smax.romanov@nginx.com nxt_msec_t idle_timeout; 27318Smax.romanov@nginx.com uint32_t requests; 28318Smax.romanov@nginx.com nxt_conf_value_t *limits_value; 29507Smax.romanov@nginx.com nxt_conf_value_t *processes_value; 301473Svbart@nginx.com nxt_conf_value_t *targets_value; 31133Sigor@sysoev.ru } nxt_router_app_conf_t; 32133Sigor@sysoev.ru 33133Sigor@sysoev.ru 34133Sigor@sysoev.ru typedef struct { 35964Sigor@sysoev.ru nxt_str_t pass; 36964Sigor@sysoev.ru nxt_str_t application; 37115Sigor@sysoev.ru } nxt_router_listener_conf_t; 38115Sigor@sysoev.ru 39115Sigor@sysoev.ru 40774Svbart@nginx.com #if (NXT_TLS) 41774Svbart@nginx.com 42774Svbart@nginx.com typedef struct { 43774Svbart@nginx.com nxt_str_t name; 44774Svbart@nginx.com nxt_socket_conf_t *conf; 45774Svbart@nginx.com 46774Svbart@nginx.com nxt_queue_link_t link; /* for nxt_socket_conf_t.tls */ 47774Svbart@nginx.com } nxt_router_tlssock_t; 48774Svbart@nginx.com 49774Svbart@nginx.com #endif 50774Svbart@nginx.com 51774Svbart@nginx.com 52198Sigor@sysoev.ru typedef struct { 53198Sigor@sysoev.ru nxt_socket_conf_t *socket_conf; 54198Sigor@sysoev.ru nxt_router_temp_conf_t *temp_conf; 55198Sigor@sysoev.ru } nxt_socket_rpc_t; 56198Sigor@sysoev.ru 57198Sigor@sysoev.ru 58507Smax.romanov@nginx.com typedef struct { 59507Smax.romanov@nginx.com nxt_app_t *app; 60507Smax.romanov@nginx.com nxt_router_temp_conf_t *temp_conf; 61507Smax.romanov@nginx.com } nxt_app_rpc_t; 62507Smax.romanov@nginx.com 63507Smax.romanov@nginx.com 64427Smax.romanov@nginx.com struct nxt_port_select_state_s { 651123Smax.romanov@nginx.com nxt_app_t *app; 661123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link; 671123Smax.romanov@nginx.com 681123Smax.romanov@nginx.com nxt_port_t *failed_port; 691123Smax.romanov@nginx.com int failed_port_use_delta; 701123Smax.romanov@nginx.com 711123Smax.romanov@nginx.com uint8_t start_process; /* 1 bit */ 721123Smax.romanov@nginx.com nxt_request_app_link_t *shared_ra; 731123Smax.romanov@nginx.com nxt_port_t *port; 74427Smax.romanov@nginx.com }; 75427Smax.romanov@nginx.com 76427Smax.romanov@nginx.com typedef struct nxt_port_select_state_s nxt_port_select_state_t; 77427Smax.romanov@nginx.com 781488St.nateldemoura@f5.com static nxt_int_t nxt_router_prefork(nxt_task_t *task, nxt_process_t *process, 791488St.nateldemoura@f5.com nxt_mp_t *mp); 801488St.nateldemoura@f5.com static nxt_int_t nxt_router_start(nxt_task_t *task, nxt_process_data_t *data); 81662Smax.romanov@nginx.com static void nxt_router_greet_controller(nxt_task_t *task, 82662Smax.romanov@nginx.com nxt_port_t *controller_port); 83662Smax.romanov@nginx.com 84427Smax.romanov@nginx.com static void nxt_router_port_select(nxt_task_t *task, 85427Smax.romanov@nginx.com nxt_port_select_state_t *state); 86427Smax.romanov@nginx.com 87427Smax.romanov@nginx.com static nxt_int_t nxt_router_port_post_select(nxt_task_t *task, 88427Smax.romanov@nginx.com nxt_port_select_state_t *state); 89427Smax.romanov@nginx.com 90507Smax.romanov@nginx.com static nxt_int_t nxt_router_start_app_process(nxt_task_t *task, nxt_app_t *app); 911123Smax.romanov@nginx.com static void nxt_request_app_link_update_peer(nxt_task_t *task, 921123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link); 931123Smax.romanov@nginx.com 94343Smax.romanov@nginx.com 95425Smax.romanov@nginx.com nxt_inline void 961123Smax.romanov@nginx.com nxt_request_app_link_inc_use(nxt_request_app_link_t *req_app_link) 97425Smax.romanov@nginx.com { 981123Smax.romanov@nginx.com nxt_atomic_fetch_add(&req_app_link->use_count, 1); 99425Smax.romanov@nginx.com } 100425Smax.romanov@nginx.com 101425Smax.romanov@nginx.com nxt_inline void 1021294Smax.romanov@nginx.com nxt_request_app_link_chk_use(nxt_request_app_link_t *req_app_link, int i) 103425Smax.romanov@nginx.com { 104538Svbart@nginx.com #if (NXT_DEBUG) 105425Smax.romanov@nginx.com int c; 106425Smax.romanov@nginx.com 1071294Smax.romanov@nginx.com c = nxt_atomic_fetch_add(&req_app_link->use_count, i); 1081294Smax.romanov@nginx.com 1091294Smax.romanov@nginx.com nxt_assert((c + i) > 0); 110538Svbart@nginx.com #else 1111294Smax.romanov@nginx.com (void) nxt_atomic_fetch_add(&req_app_link->use_count, i); 112538Svbart@nginx.com #endif 113425Smax.romanov@nginx.com } 114425Smax.romanov@nginx.com 1151123Smax.romanov@nginx.com static void nxt_request_app_link_use(nxt_task_t *task, 1161123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link, int i); 117425Smax.romanov@nginx.com 118139Sigor@sysoev.ru static nxt_router_temp_conf_t *nxt_router_temp_conf(nxt_task_t *task); 119198Sigor@sysoev.ru static void nxt_router_conf_apply(nxt_task_t *task, void *obj, void *data); 120198Sigor@sysoev.ru static void nxt_router_conf_ready(nxt_task_t *task, 121139Sigor@sysoev.ru nxt_router_temp_conf_t *tmcf); 122139Sigor@sysoev.ru static void nxt_router_conf_error(nxt_task_t *task, 123139Sigor@sysoev.ru nxt_router_temp_conf_t *tmcf); 124139Sigor@sysoev.ru static void nxt_router_conf_send(nxt_task_t *task, 125193Smax.romanov@nginx.com nxt_router_temp_conf_t *tmcf, nxt_port_msg_type_t type); 12653Sigor@sysoev.ru 127115Sigor@sysoev.ru static nxt_int_t nxt_router_conf_create(nxt_task_t *task, 128115Sigor@sysoev.ru nxt_router_temp_conf_t *tmcf, u_char *start, u_char *end); 1291183Svbart@nginx.com static nxt_int_t nxt_router_conf_process_static(nxt_task_t *task, 1301183Svbart@nginx.com nxt_router_conf_t *rtcf, nxt_conf_value_t *conf); 131133Sigor@sysoev.ru static nxt_app_t *nxt_router_app_find(nxt_queue_t *queue, nxt_str_t *name); 132198Sigor@sysoev.ru static void nxt_router_listen_socket_rpc_create(nxt_task_t *task, 133198Sigor@sysoev.ru nxt_router_temp_conf_t *tmcf, nxt_socket_conf_t *skcf); 134198Sigor@sysoev.ru static void nxt_router_listen_socket_ready(nxt_task_t *task, 135198Sigor@sysoev.ru nxt_port_recv_msg_t *msg, void *data); 136198Sigor@sysoev.ru static void nxt_router_listen_socket_error(nxt_task_t *task, 137198Sigor@sysoev.ru nxt_port_recv_msg_t *msg, void *data); 138774Svbart@nginx.com #if (NXT_TLS) 139774Svbart@nginx.com static void nxt_router_tls_rpc_create(nxt_task_t *task, 140774Svbart@nginx.com nxt_router_temp_conf_t *tmcf, nxt_router_tlssock_t *tls); 141774Svbart@nginx.com static void nxt_router_tls_rpc_handler(nxt_task_t *task, 142774Svbart@nginx.com nxt_port_recv_msg_t *msg, void *data); 143774Svbart@nginx.com #endif 144507Smax.romanov@nginx.com static void nxt_router_app_rpc_create(nxt_task_t *task, 145507Smax.romanov@nginx.com nxt_router_temp_conf_t *tmcf, nxt_app_t *app); 146507Smax.romanov@nginx.com static void nxt_router_app_prefork_ready(nxt_task_t *task, 147507Smax.romanov@nginx.com nxt_port_recv_msg_t *msg, void *data); 148507Smax.romanov@nginx.com static void nxt_router_app_prefork_error(nxt_task_t *task, 149507Smax.romanov@nginx.com nxt_port_recv_msg_t *msg, void *data); 150359Sigor@sysoev.ru static nxt_socket_conf_t *nxt_router_socket_conf(nxt_task_t *task, 151359Sigor@sysoev.ru nxt_router_temp_conf_t *tmcf, nxt_str_t *name); 152359Sigor@sysoev.ru static nxt_int_t nxt_router_listen_socket_find(nxt_router_temp_conf_t *tmcf, 153359Sigor@sysoev.ru nxt_socket_conf_t *nskcf, nxt_sockaddr_t *sa); 15453Sigor@sysoev.ru 15553Sigor@sysoev.ru static nxt_int_t nxt_router_engines_create(nxt_task_t *task, 15653Sigor@sysoev.ru nxt_router_t *router, nxt_router_temp_conf_t *tmcf, 15753Sigor@sysoev.ru const nxt_event_interface_t *interface); 158115Sigor@sysoev.ru static nxt_int_t nxt_router_engine_conf_create(nxt_router_temp_conf_t *tmcf, 159115Sigor@sysoev.ru nxt_router_engine_conf_t *recf); 160115Sigor@sysoev.ru static nxt_int_t nxt_router_engine_conf_update(nxt_router_temp_conf_t *tmcf, 161115Sigor@sysoev.ru nxt_router_engine_conf_t *recf); 162115Sigor@sysoev.ru static nxt_int_t nxt_router_engine_conf_delete(nxt_router_temp_conf_t *tmcf, 163115Sigor@sysoev.ru nxt_router_engine_conf_t *recf); 164154Sigor@sysoev.ru static nxt_int_t nxt_router_engine_joints_create(nxt_router_temp_conf_t *tmcf, 165154Sigor@sysoev.ru nxt_router_engine_conf_t *recf, nxt_queue_t *sockets, 166154Sigor@sysoev.ru nxt_work_handler_t handler); 167313Sigor@sysoev.ru static nxt_int_t nxt_router_engine_quit(nxt_router_temp_conf_t *tmcf, 168313Sigor@sysoev.ru nxt_router_engine_conf_t *recf); 169139Sigor@sysoev.ru static nxt_int_t nxt_router_engine_joints_delete(nxt_router_temp_conf_t *tmcf, 170139Sigor@sysoev.ru nxt_router_engine_conf_t *recf, nxt_queue_t *sockets); 17153Sigor@sysoev.ru 17253Sigor@sysoev.ru static nxt_int_t nxt_router_threads_create(nxt_task_t *task, nxt_runtime_t *rt, 17353Sigor@sysoev.ru nxt_router_temp_conf_t *tmcf); 17453Sigor@sysoev.ru static nxt_int_t nxt_router_thread_create(nxt_task_t *task, nxt_runtime_t *rt, 17553Sigor@sysoev.ru nxt_event_engine_t *engine); 176343Smax.romanov@nginx.com static void nxt_router_apps_sort(nxt_task_t *task, nxt_router_t *router, 177133Sigor@sysoev.ru nxt_router_temp_conf_t *tmcf); 17853Sigor@sysoev.ru 179315Sigor@sysoev.ru static void nxt_router_engines_post(nxt_router_t *router, 180315Sigor@sysoev.ru nxt_router_temp_conf_t *tmcf); 181315Sigor@sysoev.ru static void nxt_router_engine_post(nxt_event_engine_t *engine, 182315Sigor@sysoev.ru nxt_work_t *jobs); 18353Sigor@sysoev.ru 18453Sigor@sysoev.ru static void nxt_router_thread_start(void *data); 18553Sigor@sysoev.ru static void nxt_router_listen_socket_create(nxt_task_t *task, void *obj, 18653Sigor@sysoev.ru void *data); 18753Sigor@sysoev.ru static void nxt_router_listen_socket_update(nxt_task_t *task, void *obj, 18853Sigor@sysoev.ru void *data); 18953Sigor@sysoev.ru static void nxt_router_listen_socket_delete(nxt_task_t *task, void *obj, 19053Sigor@sysoev.ru void *data); 191313Sigor@sysoev.ru static void nxt_router_worker_thread_quit(nxt_task_t *task, void *obj, 192313Sigor@sysoev.ru void *data); 19353Sigor@sysoev.ru static void nxt_router_listen_socket_close(nxt_task_t *task, void *obj, 19453Sigor@sysoev.ru void *data); 19553Sigor@sysoev.ru static void nxt_router_thread_exit_handler(nxt_task_t *task, void *obj, 19653Sigor@sysoev.ru void *data); 197359Sigor@sysoev.ru static void nxt_router_listen_socket_release(nxt_task_t *task, 198359Sigor@sysoev.ru nxt_socket_conf_t *skcf); 19953Sigor@sysoev.ru 200630Svbart@nginx.com static void nxt_router_access_log_writer(nxt_task_t *task, 201630Svbart@nginx.com nxt_http_request_t *r, nxt_router_access_log_t *access_log); 202630Svbart@nginx.com static u_char *nxt_router_access_log_date(u_char *buf, nxt_realtime_t *now, 203630Svbart@nginx.com struct tm *tm, size_t size, const char *format); 204630Svbart@nginx.com static void nxt_router_access_log_open(nxt_task_t *task, 205630Svbart@nginx.com nxt_router_temp_conf_t *tmcf); 206630Svbart@nginx.com static void nxt_router_access_log_ready(nxt_task_t *task, 207630Svbart@nginx.com nxt_port_recv_msg_t *msg, void *data); 208630Svbart@nginx.com static void nxt_router_access_log_error(nxt_task_t *task, 209630Svbart@nginx.com nxt_port_recv_msg_t *msg, void *data); 210630Svbart@nginx.com static void nxt_router_access_log_release(nxt_task_t *task, 211630Svbart@nginx.com nxt_thread_spinlock_t *lock, nxt_router_access_log_t *access_log); 212651Svbart@nginx.com static void nxt_router_access_log_reopen_completion(nxt_task_t *task, void *obj, 213651Svbart@nginx.com void *data); 214631Svbart@nginx.com static void nxt_router_access_log_reopen_ready(nxt_task_t *task, 215631Svbart@nginx.com nxt_port_recv_msg_t *msg, void *data); 216631Svbart@nginx.com static void nxt_router_access_log_reopen_error(nxt_task_t *task, 217631Svbart@nginx.com nxt_port_recv_msg_t *msg, void *data); 218630Svbart@nginx.com 219343Smax.romanov@nginx.com static void nxt_router_app_port_ready(nxt_task_t *task, 220343Smax.romanov@nginx.com nxt_port_recv_msg_t *msg, void *data); 221343Smax.romanov@nginx.com static void nxt_router_app_port_error(nxt_task_t *task, 222343Smax.romanov@nginx.com nxt_port_recv_msg_t *msg, void *data); 223343Smax.romanov@nginx.com 224753Smax.romanov@nginx.com static void nxt_router_app_unlink(nxt_task_t *task, nxt_app_t *app); 2251123Smax.romanov@nginx.com 226343Smax.romanov@nginx.com static void nxt_router_app_port_release(nxt_task_t *task, nxt_port_t *port, 2271123Smax.romanov@nginx.com nxt_apr_action_t action); 228427Smax.romanov@nginx.com static nxt_int_t nxt_router_app_port(nxt_task_t *task, nxt_app_t *app, 2291123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link); 230141Smax.romanov@nginx.com 231425Smax.romanov@nginx.com static void nxt_router_app_prepare_request(nxt_task_t *task, 2321123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link); 2331007Salexander.borisov@nginx.com static nxt_buf_t *nxt_router_prepare_msg(nxt_task_t *task, 2341007Salexander.borisov@nginx.com nxt_http_request_t *r, nxt_port_t *port, const nxt_str_t *prefix); 235510Salexander.borisov@nginx.com 236318Smax.romanov@nginx.com static void nxt_router_app_timeout(nxt_task_t *task, void *obj, void *data); 237507Smax.romanov@nginx.com static void nxt_router_adjust_idle_timer(nxt_task_t *task, void *obj, 238507Smax.romanov@nginx.com void *data); 239507Smax.romanov@nginx.com static void nxt_router_app_idle_timeout(nxt_task_t *task, void *obj, 240507Smax.romanov@nginx.com void *data); 241753Smax.romanov@nginx.com static void nxt_router_app_joint_release_handler(nxt_task_t *task, void *obj, 242507Smax.romanov@nginx.com void *data); 243753Smax.romanov@nginx.com static void nxt_router_free_app(nxt_task_t *task, void *obj, void *data); 244431Sigor@sysoev.ru 245431Sigor@sysoev.ru static const nxt_http_request_state_t nxt_http_request_send_state; 246431Sigor@sysoev.ru static void nxt_http_request_send_body(nxt_task_t *task, void *obj, void *data); 247141Smax.romanov@nginx.com 248753Smax.romanov@nginx.com static void nxt_router_app_joint_use(nxt_task_t *task, 249753Smax.romanov@nginx.com nxt_app_joint_t *app_joint, int i); 250753Smax.romanov@nginx.com 2511007Salexander.borisov@nginx.com static nxt_int_t nxt_router_http_request_done(nxt_task_t *task, 2521007Salexander.borisov@nginx.com nxt_http_request_t *r); 2531007Salexander.borisov@nginx.com static void nxt_router_http_request_release(nxt_task_t *task, void *obj, 2541007Salexander.borisov@nginx.com void *data); 2551321Smax.romanov@nginx.com static void nxt_router_oosm_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg); 2561007Salexander.borisov@nginx.com 2571149Smax.romanov@nginx.com extern const nxt_http_request_state_t nxt_http_websocket; 2581131Smax.romanov@nginx.com 259119Smax.romanov@nginx.com static nxt_router_t *nxt_router; 26020Sigor@sysoev.ru 261743Smax.romanov@nginx.com static const nxt_str_t http_prefix = nxt_string("HTTP_"); 262743Smax.romanov@nginx.com static const nxt_str_t empty_prefix = nxt_string(""); 263743Smax.romanov@nginx.com 264743Smax.romanov@nginx.com static const nxt_str_t *nxt_app_msg_prefix[] = { 265804Svbart@nginx.com &empty_prefix, 266743Smax.romanov@nginx.com &http_prefix, 267743Smax.romanov@nginx.com &http_prefix, 268743Smax.romanov@nginx.com &http_prefix, 269743Smax.romanov@nginx.com &http_prefix, 270977Smax.romanov@gmail.com &empty_prefix, 271216Sigor@sysoev.ru }; 272216Sigor@sysoev.ru 273216Sigor@sysoev.ru 2741488St.nateldemoura@f5.com static const nxt_port_handlers_t nxt_router_process_port_handlers = { 2751488St.nateldemoura@f5.com .quit = nxt_signal_quit_handler, 276662Smax.romanov@nginx.com .new_port = nxt_router_new_port_handler, 277662Smax.romanov@nginx.com .change_file = nxt_port_change_log_file_handler, 278662Smax.romanov@nginx.com .mmap = nxt_port_mmap_handler, 279662Smax.romanov@nginx.com .data = nxt_router_conf_data_handler, 280662Smax.romanov@nginx.com .remove_pid = nxt_router_remove_pid_handler, 281662Smax.romanov@nginx.com .access_log = nxt_router_access_log_reopen_handler, 282662Smax.romanov@nginx.com .rpc_ready = nxt_port_rpc_handler, 283662Smax.romanov@nginx.com .rpc_error = nxt_port_rpc_handler, 2841321Smax.romanov@nginx.com .oosm = nxt_router_oosm_handler, 285662Smax.romanov@nginx.com }; 286662Smax.romanov@nginx.com 287662Smax.romanov@nginx.com 2881488St.nateldemoura@f5.com const nxt_process_init_t nxt_router_process = { 2891488St.nateldemoura@f5.com .name = "router", 2901488St.nateldemoura@f5.com .type = NXT_PROCESS_ROUTER, 2911488St.nateldemoura@f5.com .prefork = nxt_router_prefork, 2921488St.nateldemoura@f5.com .restart = 1, 2931488St.nateldemoura@f5.com .setup = nxt_process_core_setup, 2941488St.nateldemoura@f5.com .start = nxt_router_start, 2951488St.nateldemoura@f5.com .port_handlers = &nxt_router_process_port_handlers, 2961488St.nateldemoura@f5.com .signals = nxt_process_signals, 2971488St.nateldemoura@f5.com }; 2981488St.nateldemoura@f5.com 2991488St.nateldemoura@f5.com 300*1509Sigor@sysoev.ru /* Queues of nxt_socket_conf_t */ 301*1509Sigor@sysoev.ru nxt_queue_t creating_sockets; 302*1509Sigor@sysoev.ru nxt_queue_t pending_sockets; 303*1509Sigor@sysoev.ru nxt_queue_t updating_sockets; 304*1509Sigor@sysoev.ru nxt_queue_t keeping_sockets; 305*1509Sigor@sysoev.ru nxt_queue_t deleting_sockets; 306*1509Sigor@sysoev.ru 307*1509Sigor@sysoev.ru 3081488St.nateldemoura@f5.com static nxt_int_t 3091488St.nateldemoura@f5.com nxt_router_prefork(nxt_task_t *task, nxt_process_t *process, nxt_mp_t *mp) 3101488St.nateldemoura@f5.com { 3111488St.nateldemoura@f5.com nxt_runtime_stop_app_processes(task, task->thread->runtime); 3121488St.nateldemoura@f5.com 3131488St.nateldemoura@f5.com return NXT_OK; 3141488St.nateldemoura@f5.com } 3151488St.nateldemoura@f5.com 3161488St.nateldemoura@f5.com 3171488St.nateldemoura@f5.com static nxt_int_t 3181488St.nateldemoura@f5.com nxt_router_start(nxt_task_t *task, nxt_process_data_t *data) 31920Sigor@sysoev.ru { 320141Smax.romanov@nginx.com nxt_int_t ret; 321662Smax.romanov@nginx.com nxt_port_t *controller_port; 322141Smax.romanov@nginx.com nxt_router_t *router; 323141Smax.romanov@nginx.com nxt_runtime_t *rt; 324141Smax.romanov@nginx.com 325141Smax.romanov@nginx.com rt = task->thread->runtime; 32653Sigor@sysoev.ru 3271488St.nateldemoura@f5.com nxt_log(task, NXT_LOG_INFO, "router started"); 3281488St.nateldemoura@f5.com 329771Sigor@sysoev.ru #if (NXT_TLS) 330771Sigor@sysoev.ru rt->tls = nxt_service_get(rt->services, "SSL/TLS", "OpenSSL"); 331771Sigor@sysoev.ru if (nxt_slow_path(rt->tls == NULL)) { 332771Sigor@sysoev.ru return NXT_ERROR; 333771Sigor@sysoev.ru } 334771Sigor@sysoev.ru 335771Sigor@sysoev.ru ret = rt->tls->library_init(task); 336771Sigor@sysoev.ru if (nxt_slow_path(ret != NXT_OK)) { 337771Sigor@sysoev.ru return ret; 338771Sigor@sysoev.ru } 339771Sigor@sysoev.ru #endif 340771Sigor@sysoev.ru 3411459Smax.romanov@nginx.com ret = nxt_http_init(task); 34288Smax.romanov@nginx.com if (nxt_slow_path(ret != NXT_OK)) { 34388Smax.romanov@nginx.com return ret; 34488Smax.romanov@nginx.com } 34588Smax.romanov@nginx.com 34653Sigor@sysoev.ru router = nxt_zalloc(sizeof(nxt_router_t)); 34753Sigor@sysoev.ru if (nxt_slow_path(router == NULL)) { 34853Sigor@sysoev.ru return NXT_ERROR; 34953Sigor@sysoev.ru } 35053Sigor@sysoev.ru 35153Sigor@sysoev.ru nxt_queue_init(&router->engines); 35253Sigor@sysoev.ru nxt_queue_init(&router->sockets); 353133Sigor@sysoev.ru nxt_queue_init(&router->apps); 35453Sigor@sysoev.ru 355119Smax.romanov@nginx.com nxt_router = router; 356119Smax.romanov@nginx.com 357662Smax.romanov@nginx.com controller_port = rt->port_by_type[NXT_PROCESS_CONTROLLER]; 358662Smax.romanov@nginx.com if (controller_port != NULL) { 359662Smax.romanov@nginx.com nxt_router_greet_controller(task, controller_port); 360662Smax.romanov@nginx.com } 361662Smax.romanov@nginx.com 362115Sigor@sysoev.ru return NXT_OK; 363115Sigor@sysoev.ru } 364115Sigor@sysoev.ru 365115Sigor@sysoev.ru 366343Smax.romanov@nginx.com static void 367662Smax.romanov@nginx.com nxt_router_greet_controller(nxt_task_t *task, nxt_port_t *controller_port) 368662Smax.romanov@nginx.com { 369662Smax.romanov@nginx.com nxt_port_socket_write(task, controller_port, NXT_PORT_MSG_PROCESS_READY, 370662Smax.romanov@nginx.com -1, 0, 0, NULL); 371662Smax.romanov@nginx.com } 372662Smax.romanov@nginx.com 373662Smax.romanov@nginx.com 374662Smax.romanov@nginx.com static void 375507Smax.romanov@nginx.com nxt_router_start_app_process_handler(nxt_task_t *task, nxt_port_t *port, 376507Smax.romanov@nginx.com void *data) 377167Smax.romanov@nginx.com { 378343Smax.romanov@nginx.com size_t size; 379343Smax.romanov@nginx.com uint32_t stream; 380430Sigor@sysoev.ru nxt_mp_t *mp; 381648Svbart@nginx.com nxt_int_t ret; 382343Smax.romanov@nginx.com nxt_app_t *app; 383343Smax.romanov@nginx.com nxt_buf_t *b; 384343Smax.romanov@nginx.com nxt_port_t *main_port; 385343Smax.romanov@nginx.com nxt_runtime_t *rt; 386343Smax.romanov@nginx.com 387343Smax.romanov@nginx.com app = data; 388167Smax.romanov@nginx.com 389167Smax.romanov@nginx.com rt = task->thread->runtime; 390240Sigor@sysoev.ru main_port = rt->port_by_type[NXT_PROCESS_MAIN]; 391167Smax.romanov@nginx.com 392507Smax.romanov@nginx.com nxt_debug(task, "app '%V' %p start process", &app->name, app); 393343Smax.romanov@nginx.com 394343Smax.romanov@nginx.com size = app->name.length + 1 + app->conf.length; 395343Smax.romanov@nginx.com 396343Smax.romanov@nginx.com b = nxt_buf_mem_ts_alloc(task, task->thread->engine->mem_pool, size); 397343Smax.romanov@nginx.com 398343Smax.romanov@nginx.com if (nxt_slow_path(b == NULL)) { 399343Smax.romanov@nginx.com goto failed; 400167Smax.romanov@nginx.com } 401167Smax.romanov@nginx.com 402343Smax.romanov@nginx.com nxt_buf_cpystr(b, &app->name); 403343Smax.romanov@nginx.com *b->mem.free++ = '\0'; 404343Smax.romanov@nginx.com nxt_buf_cpystr(b, &app->conf); 405343Smax.romanov@nginx.com 406753Smax.romanov@nginx.com nxt_router_app_joint_use(task, app->joint, 1); 407753Smax.romanov@nginx.com 408343Smax.romanov@nginx.com stream = nxt_port_rpc_register_handler(task, port, 409343Smax.romanov@nginx.com nxt_router_app_port_ready, 410343Smax.romanov@nginx.com nxt_router_app_port_error, 411753Smax.romanov@nginx.com -1, app->joint); 412343Smax.romanov@nginx.com 413343Smax.romanov@nginx.com if (nxt_slow_path(stream == 0)) { 414753Smax.romanov@nginx.com nxt_router_app_joint_use(task, app->joint, -1); 415753Smax.romanov@nginx.com 416343Smax.romanov@nginx.com goto failed; 417343Smax.romanov@nginx.com } 418343Smax.romanov@nginx.com 4191488St.nateldemoura@f5.com ret = nxt_port_socket_write(task, main_port, NXT_PORT_MSG_START_PROCESS, 4201488St.nateldemoura@f5.com -1, stream, port->id, b); 421648Svbart@nginx.com 422648Svbart@nginx.com if (nxt_slow_path(ret != NXT_OK)) { 423648Svbart@nginx.com nxt_port_rpc_cancel(task, port, stream); 424753Smax.romanov@nginx.com 425753Smax.romanov@nginx.com nxt_router_app_joint_use(task, app->joint, -1); 426753Smax.romanov@nginx.com 427648Svbart@nginx.com goto failed; 428648Svbart@nginx.com } 429343Smax.romanov@nginx.com 430753Smax.romanov@nginx.com nxt_router_app_use(task, app, -1); 431753Smax.romanov@nginx.com 432343Smax.romanov@nginx.com return; 433343Smax.romanov@nginx.com 434343Smax.romanov@nginx.com failed: 435343Smax.romanov@nginx.com 436648Svbart@nginx.com if (b != NULL) { 437648Svbart@nginx.com mp = b->data; 438648Svbart@nginx.com nxt_mp_free(mp, b); 439648Svbart@nginx.com nxt_mp_release(mp); 440648Svbart@nginx.com } 441648Svbart@nginx.com 442343Smax.romanov@nginx.com nxt_thread_mutex_lock(&app->mutex); 443343Smax.romanov@nginx.com 444507Smax.romanov@nginx.com app->pending_processes--; 445343Smax.romanov@nginx.com 446343Smax.romanov@nginx.com nxt_thread_mutex_unlock(&app->mutex); 447343Smax.romanov@nginx.com 448343Smax.romanov@nginx.com nxt_router_app_use(task, app, -1); 449167Smax.romanov@nginx.com } 450167Smax.romanov@nginx.com 451167Smax.romanov@nginx.com 452753Smax.romanov@nginx.com static void 453753Smax.romanov@nginx.com nxt_router_app_joint_use(nxt_task_t *task, nxt_app_joint_t *app_joint, int i) 454753Smax.romanov@nginx.com { 455753Smax.romanov@nginx.com app_joint->use_count += i; 456753Smax.romanov@nginx.com 457753Smax.romanov@nginx.com if (app_joint->use_count == 0) { 458753Smax.romanov@nginx.com nxt_assert(app_joint->app == NULL); 459753Smax.romanov@nginx.com 460753Smax.romanov@nginx.com nxt_free(app_joint); 461753Smax.romanov@nginx.com } 462753Smax.romanov@nginx.com } 463753Smax.romanov@nginx.com 464753Smax.romanov@nginx.com 465343Smax.romanov@nginx.com static nxt_int_t 466507Smax.romanov@nginx.com nxt_router_start_app_process(nxt_task_t *task, nxt_app_t *app) 467141Smax.romanov@nginx.com { 468343Smax.romanov@nginx.com nxt_int_t res; 469343Smax.romanov@nginx.com nxt_port_t *router_port; 470343Smax.romanov@nginx.com nxt_runtime_t *rt; 471343Smax.romanov@nginx.com 472343Smax.romanov@nginx.com rt = task->thread->runtime; 473343Smax.romanov@nginx.com router_port = rt->port_by_type[NXT_PROCESS_ROUTER]; 474343Smax.romanov@nginx.com 475343Smax.romanov@nginx.com nxt_router_app_use(task, app, 1); 476343Smax.romanov@nginx.com 477507Smax.romanov@nginx.com res = nxt_port_post(task, router_port, nxt_router_start_app_process_handler, 478343Smax.romanov@nginx.com app); 479343Smax.romanov@nginx.com 480343Smax.romanov@nginx.com if (res == NXT_OK) { 481343Smax.romanov@nginx.com return res; 482318Smax.romanov@nginx.com } 483318Smax.romanov@nginx.com 484343Smax.romanov@nginx.com nxt_thread_mutex_lock(&app->mutex); 485343Smax.romanov@nginx.com 486507Smax.romanov@nginx.com app->pending_processes--; 487343Smax.romanov@nginx.com 488343Smax.romanov@nginx.com nxt_thread_mutex_unlock(&app->mutex); 489343Smax.romanov@nginx.com 490343Smax.romanov@nginx.com nxt_router_app_use(task, app, -1); 491343Smax.romanov@nginx.com 492343Smax.romanov@nginx.com return NXT_ERROR; 493318Smax.romanov@nginx.com } 494318Smax.romanov@nginx.com 495318Smax.romanov@nginx.com 496351Smax.romanov@nginx.com nxt_inline void 4971123Smax.romanov@nginx.com nxt_request_app_link_init(nxt_task_t *task, 4981123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link, nxt_request_rpc_data_t *req_rpc_data) 499167Smax.romanov@nginx.com { 5001414Smax.romanov@nginx.com nxt_buf_t *body; 501318Smax.romanov@nginx.com nxt_event_engine_t *engine; 502351Smax.romanov@nginx.com 503318Smax.romanov@nginx.com engine = task->thread->engine; 504167Smax.romanov@nginx.com 5051123Smax.romanov@nginx.com nxt_memzero(req_app_link, sizeof(nxt_request_app_link_t)); 5061123Smax.romanov@nginx.com 5071123Smax.romanov@nginx.com req_app_link->stream = req_rpc_data->stream; 5081123Smax.romanov@nginx.com req_app_link->use_count = 1; 5091123Smax.romanov@nginx.com req_app_link->req_rpc_data = req_rpc_data; 5101123Smax.romanov@nginx.com req_rpc_data->req_app_link = req_app_link; 5111123Smax.romanov@nginx.com req_app_link->reply_port = engine->port; 5121123Smax.romanov@nginx.com req_app_link->request = req_rpc_data->request; 5131123Smax.romanov@nginx.com req_app_link->apr_action = NXT_APR_GOT_RESPONSE; 5141123Smax.romanov@nginx.com 5151123Smax.romanov@nginx.com req_app_link->work.handler = NULL; 5161123Smax.romanov@nginx.com req_app_link->work.task = &engine->task; 5171123Smax.romanov@nginx.com req_app_link->work.obj = req_app_link; 5181123Smax.romanov@nginx.com req_app_link->work.data = engine; 5191414Smax.romanov@nginx.com 5201414Smax.romanov@nginx.com body = req_rpc_data->request->body; 5211414Smax.romanov@nginx.com 5221414Smax.romanov@nginx.com if (body != NULL && nxt_buf_is_file(body)) { 5231414Smax.romanov@nginx.com req_app_link->body_fd = body->file->fd; 5241414Smax.romanov@nginx.com 5251414Smax.romanov@nginx.com body->file->fd = -1; 5261414Smax.romanov@nginx.com 5271414Smax.romanov@nginx.com } else { 5281414Smax.romanov@nginx.com req_app_link->body_fd = -1; 5291414Smax.romanov@nginx.com } 530351Smax.romanov@nginx.com } 531351Smax.romanov@nginx.com 532351Smax.romanov@nginx.com 5331123Smax.romanov@nginx.com nxt_inline nxt_request_app_link_t * 5341123Smax.romanov@nginx.com nxt_request_app_link_alloc(nxt_task_t *task, 5351123Smax.romanov@nginx.com nxt_request_app_link_t *ra_src, nxt_request_rpc_data_t *req_rpc_data) 536351Smax.romanov@nginx.com { 5371123Smax.romanov@nginx.com nxt_mp_t *mp; 5381123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link; 5391123Smax.romanov@nginx.com 5401123Smax.romanov@nginx.com if (ra_src != NULL && ra_src->mem_pool != NULL) { 541425Smax.romanov@nginx.com return ra_src; 542425Smax.romanov@nginx.com } 543425Smax.romanov@nginx.com 5441123Smax.romanov@nginx.com mp = req_rpc_data->request->mem_pool; 5451123Smax.romanov@nginx.com 5461123Smax.romanov@nginx.com req_app_link = nxt_mp_alloc(mp, sizeof(nxt_request_app_link_t)); 5471123Smax.romanov@nginx.com 5481123Smax.romanov@nginx.com if (nxt_slow_path(req_app_link == NULL)) { 5491123Smax.romanov@nginx.com 5501123Smax.romanov@nginx.com req_rpc_data->req_app_link = NULL; 5511123Smax.romanov@nginx.com 5521123Smax.romanov@nginx.com if (ra_src != NULL) { 5531123Smax.romanov@nginx.com ra_src->req_rpc_data = NULL; 5541123Smax.romanov@nginx.com } 555351Smax.romanov@nginx.com 556351Smax.romanov@nginx.com return NULL; 557351Smax.romanov@nginx.com } 558351Smax.romanov@nginx.com 559430Sigor@sysoev.ru nxt_mp_retain(mp); 560430Sigor@sysoev.ru 5611123Smax.romanov@nginx.com nxt_request_app_link_init(task, req_app_link, req_rpc_data); 5621123Smax.romanov@nginx.com 5631414Smax.romanov@nginx.com if (ra_src != NULL) { 5641414Smax.romanov@nginx.com req_app_link->body_fd = ra_src->body_fd; 5651414Smax.romanov@nginx.com } 5661414Smax.romanov@nginx.com 5671123Smax.romanov@nginx.com req_app_link->mem_pool = mp; 5681123Smax.romanov@nginx.com 5691123Smax.romanov@nginx.com return req_app_link; 570167Smax.romanov@nginx.com } 571167Smax.romanov@nginx.com 572167Smax.romanov@nginx.com 573423Smax.romanov@nginx.com nxt_inline nxt_bool_t 574423Smax.romanov@nginx.com nxt_router_msg_cancel(nxt_task_t *task, nxt_msg_info_t *msg_info, 575423Smax.romanov@nginx.com uint32_t stream) 576423Smax.romanov@nginx.com { 577423Smax.romanov@nginx.com nxt_buf_t *b, *next; 578423Smax.romanov@nginx.com nxt_bool_t cancelled; 579423Smax.romanov@nginx.com 580423Smax.romanov@nginx.com if (msg_info->buf == NULL) { 581423Smax.romanov@nginx.com return 0; 582423Smax.romanov@nginx.com } 583423Smax.romanov@nginx.com 584423Smax.romanov@nginx.com cancelled = nxt_port_mmap_tracking_cancel(task, &msg_info->tracking, 585423Smax.romanov@nginx.com stream); 586423Smax.romanov@nginx.com 587423Smax.romanov@nginx.com if (cancelled) { 588423Smax.romanov@nginx.com nxt_debug(task, "stream #%uD: cancelled by router", stream); 589423Smax.romanov@nginx.com } 590423Smax.romanov@nginx.com 591423Smax.romanov@nginx.com for (b = msg_info->buf; b != NULL; b = next) { 592423Smax.romanov@nginx.com next = b->next; 5931269Sigor@sysoev.ru b->next = NULL; 594423Smax.romanov@nginx.com 595423Smax.romanov@nginx.com b->completion_handler = msg_info->completion_handler; 596423Smax.romanov@nginx.com 597423Smax.romanov@nginx.com if (b->is_port_mmap_sent) { 598423Smax.romanov@nginx.com b->is_port_mmap_sent = cancelled == 0; 599423Smax.romanov@nginx.com b->completion_handler(task, b, b->parent); 600423Smax.romanov@nginx.com } 601423Smax.romanov@nginx.com } 602423Smax.romanov@nginx.com 603423Smax.romanov@nginx.com msg_info->buf = NULL; 604423Smax.romanov@nginx.com 605423Smax.romanov@nginx.com return cancelled; 606423Smax.romanov@nginx.com } 607423Smax.romanov@nginx.com 608423Smax.romanov@nginx.com 609167Smax.romanov@nginx.com static void 6101123Smax.romanov@nginx.com nxt_request_app_link_update_peer_handler(nxt_task_t *task, void *obj, 6111123Smax.romanov@nginx.com void *data) 6121123Smax.romanov@nginx.com { 6131123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link; 6141123Smax.romanov@nginx.com 6151123Smax.romanov@nginx.com req_app_link = obj; 6161123Smax.romanov@nginx.com 6171123Smax.romanov@nginx.com nxt_request_app_link_update_peer(task, req_app_link); 6181123Smax.romanov@nginx.com 6191123Smax.romanov@nginx.com nxt_request_app_link_use(task, req_app_link, -1); 6201123Smax.romanov@nginx.com } 621425Smax.romanov@nginx.com 622425Smax.romanov@nginx.com 623425Smax.romanov@nginx.com static void 6241123Smax.romanov@nginx.com nxt_request_app_link_update_peer(nxt_task_t *task, 6251123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link) 626167Smax.romanov@nginx.com { 6271123Smax.romanov@nginx.com nxt_event_engine_t *engine; 6281123Smax.romanov@nginx.com nxt_request_rpc_data_t *req_rpc_data; 6291123Smax.romanov@nginx.com 6301123Smax.romanov@nginx.com engine = req_app_link->work.data; 6311123Smax.romanov@nginx.com 6321123Smax.romanov@nginx.com if (task->thread->engine != engine) { 6331123Smax.romanov@nginx.com nxt_request_app_link_inc_use(req_app_link); 6341123Smax.romanov@nginx.com 6351123Smax.romanov@nginx.com req_app_link->work.handler = nxt_request_app_link_update_peer_handler; 6361123Smax.romanov@nginx.com req_app_link->work.task = &engine->task; 6371123Smax.romanov@nginx.com req_app_link->work.next = NULL; 6381123Smax.romanov@nginx.com 6391123Smax.romanov@nginx.com nxt_debug(task, "req_app_link stream #%uD post update peer to %p", 6401123Smax.romanov@nginx.com req_app_link->stream, engine); 6411123Smax.romanov@nginx.com 6421123Smax.romanov@nginx.com nxt_event_engine_post(engine, &req_app_link->work); 6431123Smax.romanov@nginx.com 6441123Smax.romanov@nginx.com return; 6451123Smax.romanov@nginx.com } 6461123Smax.romanov@nginx.com 6471123Smax.romanov@nginx.com nxt_debug(task, "req_app_link stream #%uD update peer", 6481123Smax.romanov@nginx.com req_app_link->stream); 6491123Smax.romanov@nginx.com 6501123Smax.romanov@nginx.com req_rpc_data = req_app_link->req_rpc_data; 6511123Smax.romanov@nginx.com 6521123Smax.romanov@nginx.com if (req_rpc_data != NULL && req_app_link->app_port != NULL) { 6531123Smax.romanov@nginx.com nxt_port_rpc_ex_set_peer(task, engine->port, req_rpc_data, 6541123Smax.romanov@nginx.com req_app_link->app_port->pid); 6551123Smax.romanov@nginx.com } 656425Smax.romanov@nginx.com } 657425Smax.romanov@nginx.com 658425Smax.romanov@nginx.com 659425Smax.romanov@nginx.com static void 6601123Smax.romanov@nginx.com nxt_request_app_link_release(nxt_task_t *task, 6611123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link) 662425Smax.romanov@nginx.com { 663431Sigor@sysoev.ru nxt_mp_t *mp; 6641131Smax.romanov@nginx.com nxt_http_request_t *r; 6651123Smax.romanov@nginx.com nxt_request_rpc_data_t *req_rpc_data; 6661123Smax.romanov@nginx.com 6671123Smax.romanov@nginx.com nxt_assert(task->thread->engine == req_app_link->work.data); 6681123Smax.romanov@nginx.com nxt_assert(req_app_link->use_count == 0); 6691123Smax.romanov@nginx.com 6701123Smax.romanov@nginx.com nxt_debug(task, "req_app_link stream #%uD release", req_app_link->stream); 6711123Smax.romanov@nginx.com 6721123Smax.romanov@nginx.com req_rpc_data = req_app_link->req_rpc_data; 6731123Smax.romanov@nginx.com 6741123Smax.romanov@nginx.com if (req_rpc_data != NULL) { 6751123Smax.romanov@nginx.com if (nxt_slow_path(req_app_link->err_code != 0)) { 6761123Smax.romanov@nginx.com nxt_http_request_error(task, req_rpc_data->request, 6771123Smax.romanov@nginx.com req_app_link->err_code); 678423Smax.romanov@nginx.com 679423Smax.romanov@nginx.com } else { 6801123Smax.romanov@nginx.com req_rpc_data->app_port = req_app_link->app_port; 6811123Smax.romanov@nginx.com req_rpc_data->apr_action = req_app_link->apr_action; 6821123Smax.romanov@nginx.com req_rpc_data->msg_info = req_app_link->msg_info; 6831123Smax.romanov@nginx.com 6841123Smax.romanov@nginx.com if (req_rpc_data->app->timeout != 0) { 6851131Smax.romanov@nginx.com r = req_rpc_data->request; 6861131Smax.romanov@nginx.com 6871131Smax.romanov@nginx.com r->timer.handler = nxt_router_app_timeout; 6881131Smax.romanov@nginx.com r->timer_data = req_rpc_data; 6891131Smax.romanov@nginx.com nxt_timer_add(task->thread->engine, &r->timer, 6901123Smax.romanov@nginx.com req_rpc_data->app->timeout); 691425Smax.romanov@nginx.com } 692425Smax.romanov@nginx.com 6931123Smax.romanov@nginx.com req_app_link->app_port = NULL; 6941123Smax.romanov@nginx.com req_app_link->msg_info.buf = NULL; 695423Smax.romanov@nginx.com } 696343Smax.romanov@nginx.com 6971123Smax.romanov@nginx.com req_rpc_data->req_app_link = NULL; 6981123Smax.romanov@nginx.com req_app_link->req_rpc_data = NULL; 6991123Smax.romanov@nginx.com } 7001123Smax.romanov@nginx.com 7011123Smax.romanov@nginx.com if (req_app_link->app_port != NULL) { 7021123Smax.romanov@nginx.com nxt_router_app_port_release(task, req_app_link->app_port, 7031123Smax.romanov@nginx.com req_app_link->apr_action); 7041123Smax.romanov@nginx.com 7051123Smax.romanov@nginx.com req_app_link->app_port = NULL; 7061123Smax.romanov@nginx.com } 7071123Smax.romanov@nginx.com 7081414Smax.romanov@nginx.com if (req_app_link->body_fd != -1) { 7091414Smax.romanov@nginx.com nxt_fd_close(req_app_link->body_fd); 7101414Smax.romanov@nginx.com 7111414Smax.romanov@nginx.com req_app_link->body_fd = -1; 7121414Smax.romanov@nginx.com } 7131414Smax.romanov@nginx.com 7141123Smax.romanov@nginx.com nxt_router_msg_cancel(task, &req_app_link->msg_info, req_app_link->stream); 7151123Smax.romanov@nginx.com 7161123Smax.romanov@nginx.com mp = req_app_link->mem_pool; 717430Sigor@sysoev.ru 718430Sigor@sysoev.ru if (mp != NULL) { 7191123Smax.romanov@nginx.com nxt_mp_free(mp, req_app_link); 720430Sigor@sysoev.ru nxt_mp_release(mp); 721351Smax.romanov@nginx.com } 722167Smax.romanov@nginx.com } 723167Smax.romanov@nginx.com 724167Smax.romanov@nginx.com 725425Smax.romanov@nginx.com static void 7261123Smax.romanov@nginx.com nxt_request_app_link_release_handler(nxt_task_t *task, void *obj, void *data) 727425Smax.romanov@nginx.com { 7281123Smax.romanov@nginx.com nxt_request_app_link_t *req_app_link; 7291123Smax.romanov@nginx.com 730