Application-side message processing.
Usage on the router side:
nxt_app_wmsg_t wmsg;
nxt_app_parse_ctx_t parse_ctx;
nxt_app_http_req_init(task, &parse_ctx);
/* parse incoming request data */
if (nxt_app_http_req_parse(task, &parse_ctx, buf) == NXT_DONE) {
/* choose app */
nxt_app = nxt_select_app(... &parse_ctx.r ...);
/* find port */
wmsg.port = nxt_get_app_port(... nxt_app ...);
wmsg.buf = &wmsg.write;
/* fill write message buffer in shared mem */
nxt_app->prepare_msg(task, &parse_ctx.r, &wmsg);
/* send message to app for processing */
nxt_port_socket_write(task, wmsg.port, NXT_PORT_MSG_DATA,
-1, 0, 0, wmsg.write);
}
This commit is contained in:
@@ -189,7 +189,7 @@ nxt_master_start_worker_processes(nxt_task_t *task, nxt_runtime_t *rt)
|
||||
init->start = nxt_app_start;
|
||||
init->name = "worker process";
|
||||
init->user_cred = &rt->user_cred;
|
||||
init->port_handlers = nxt_worker_process_port_handlers;
|
||||
init->port_handlers = nxt_app_process_port_handlers;
|
||||
init->signals = nxt_worker_process_signals;
|
||||
init->type = NXT_PROCESS_WORKER;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user