nxt_router.c (1549:cad592a06086) nxt_router.c (1552:a363564c527c)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_router.h>

--- 55 unchanged lines hidden (view full) ---

64static nxt_int_t nxt_router_prefork(nxt_task_t *task, nxt_process_t *process,
65 nxt_mp_t *mp);
66static nxt_int_t nxt_router_start(nxt_task_t *task, nxt_process_data_t *data);
67static void nxt_router_greet_controller(nxt_task_t *task,
68 nxt_port_t *controller_port);
69
70static nxt_int_t nxt_router_start_app_process(nxt_task_t *task, nxt_app_t *app);
71
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_router.h>

--- 55 unchanged lines hidden (view full) ---

64static nxt_int_t nxt_router_prefork(nxt_task_t *task, nxt_process_t *process,
65 nxt_mp_t *mp);
66static nxt_int_t nxt_router_start(nxt_task_t *task, nxt_process_data_t *data);
67static void nxt_router_greet_controller(nxt_task_t *task,
68 nxt_port_t *controller_port);
69
70static nxt_int_t nxt_router_start_app_process(nxt_task_t *task, nxt_app_t *app);
71
72static void nxt_router_new_port_handler(nxt_task_t *task,
73 nxt_port_recv_msg_t *msg);
74static void nxt_router_conf_data_handler(nxt_task_t *task,
75 nxt_port_recv_msg_t *msg);
76static void nxt_router_remove_pid_handler(nxt_task_t *task,
77 nxt_port_recv_msg_t *msg);
78static void nxt_router_access_log_reopen_handler(nxt_task_t *task,
79 nxt_port_recv_msg_t *msg);
80
72static nxt_router_temp_conf_t *nxt_router_temp_conf(nxt_task_t *task);
73static void nxt_router_conf_apply(nxt_task_t *task, void *obj, void *data);
74static void nxt_router_conf_ready(nxt_task_t *task,
75 nxt_router_temp_conf_t *tmcf);
76static void nxt_router_conf_error(nxt_task_t *task,
77 nxt_router_temp_conf_t *tmcf);
78static void nxt_router_conf_send(nxt_task_t *task,
79 nxt_router_temp_conf_t *tmcf, nxt_port_msg_type_t type);

--- 476 unchanged lines hidden (view full) ---

556 req_rpc_data->rpc_cancel = 0;
557
558 nxt_port_rpc_cancel(task, task->thread->engine->port,
559 req_rpc_data->stream);
560 }
561}
562
563
81static nxt_router_temp_conf_t *nxt_router_temp_conf(nxt_task_t *task);
82static void nxt_router_conf_apply(nxt_task_t *task, void *obj, void *data);
83static void nxt_router_conf_ready(nxt_task_t *task,
84 nxt_router_temp_conf_t *tmcf);
85static void nxt_router_conf_error(nxt_task_t *task,
86 nxt_router_temp_conf_t *tmcf);
87static void nxt_router_conf_send(nxt_task_t *task,
88 nxt_router_temp_conf_t *tmcf, nxt_port_msg_type_t type);

--- 476 unchanged lines hidden (view full) ---

565 req_rpc_data->rpc_cancel = 0;
566
567 nxt_port_rpc_cancel(task, task->thread->engine->port,
568 req_rpc_data->stream);
569 }
570}
571
572
564void
573static void
565nxt_router_new_port_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
566{
567 nxt_app_t *app;
568 nxt_port_t *port, *main_app_port;
569 nxt_runtime_t *rt;
570
571 nxt_port_new_port_handler(task, msg);
572

--- 45 unchanged lines hidden (view full) ---

618
619 nxt_thread_mutex_unlock(&app->mutex);
620
621 port->app = app;
622 port->main_app_port = main_app_port;
623}
624
625
574nxt_router_new_port_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
575{
576 nxt_app_t *app;
577 nxt_port_t *port, *main_app_port;
578 nxt_runtime_t *rt;
579
580 nxt_port_new_port_handler(task, msg);
581

--- 45 unchanged lines hidden (view full) ---

627
628 nxt_thread_mutex_unlock(&app->mutex);
629
630 port->app = app;
631 port->main_app_port = main_app_port;
632}
633
634
626void
635static void
627nxt_router_conf_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
628{
629 void *p;
630 size_t size;
631 nxt_int_t ret;
632 nxt_router_temp_conf_t *tmcf;
633
634 tmcf = nxt_router_temp_conf(task);

--- 68 unchanged lines hidden (view full) ---

703 } u;
704
705 u.data = data;
706
707 nxt_port_rpc_remove_peer(task, port, u.removed_pid);
708}
709
710
636nxt_router_conf_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
637{
638 void *p;
639 size_t size;
640 nxt_int_t ret;
641 nxt_router_temp_conf_t *tmcf;
642
643 tmcf = nxt_router_temp_conf(task);

--- 68 unchanged lines hidden (view full) ---

712 } u;
713
714 u.data = data;
715
716 nxt_port_rpc_remove_peer(task, port, u.removed_pid);
717}
718
719
711void
720static void
712nxt_router_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
713{
714 nxt_event_engine_t *engine;
715
716 nxt_port_remove_pid_handler(task, msg);
717
718 nxt_queue_each(engine, &nxt_router->engines, nxt_event_engine_t, link0)
719 {

--- 2598 unchanged lines hidden (view full) ---

3318
3319
3320typedef struct {
3321 nxt_mp_t *mem_pool;
3322 nxt_router_access_log_t *access_log;
3323} nxt_router_access_log_reopen_t;
3324
3325
721nxt_router_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
722{
723 nxt_event_engine_t *engine;
724
725 nxt_port_remove_pid_handler(task, msg);
726
727 nxt_queue_each(engine, &nxt_router->engines, nxt_event_engine_t, link0)
728 {

--- 2598 unchanged lines hidden (view full) ---

3327
3328
3329typedef struct {
3330 nxt_mp_t *mem_pool;
3331 nxt_router_access_log_t *access_log;
3332} nxt_router_access_log_reopen_t;
3333
3334
3326void
3335static void
3327nxt_router_access_log_reopen_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
3328{
3329 nxt_mp_t *mp;
3330 uint32_t stream;
3331 nxt_int_t ret;
3332 nxt_buf_t *b;
3333 nxt_port_t *main_port, *router_port;
3334 nxt_runtime_t *rt;

--- 1782 unchanged lines hidden ---
3336nxt_router_access_log_reopen_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
3337{
3338 nxt_mp_t *mp;
3339 uint32_t stream;
3340 nxt_int_t ret;
3341 nxt_buf_t *b;
3342 nxt_port_t *main_port, *router_port;
3343 nxt_runtime_t *rt;

--- 1782 unchanged lines hidden ---