diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-06-23 19:20:08 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-06-23 19:20:08 +0300 |
commit | e7a0634a718ca1f2379f4694c17ef4219f5538fa (patch) | |
tree | fea96a90de03c1297b9378c0cfc92bd463ed5795 /src/nxt_worker_process.c | |
parent | 3b9aa27625e50dea5fed2644e80ea454605a3006 (diff) | |
download | unit-e7a0634a718ca1f2379f4694c17ef4219f5538fa.tar.gz unit-e7a0634a718ca1f2379f4694c17ef4219f5538fa.tar.bz2 |
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);
}
Diffstat (limited to '')
-rw-r--r-- | src/nxt_worker_process.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nxt_worker_process.c b/src/nxt_worker_process.c index 6407c734..4c5b6888 100644 --- a/src/nxt_worker_process.c +++ b/src/nxt_worker_process.c @@ -30,6 +30,15 @@ nxt_port_handler_t nxt_worker_process_port_handlers[] = { }; +nxt_port_handler_t nxt_app_process_port_handlers[] = { + nxt_worker_process_quit_handler, + nxt_port_new_port_handler, + nxt_port_change_log_file_handler, + nxt_port_mmap_handler, + nxt_port_app_data_handler, +}; + + const nxt_sig_event_t nxt_worker_process_signals[] = { nxt_event_signal(SIGHUP, nxt_worker_process_signal_handler), nxt_event_signal(SIGINT, nxt_worker_process_sigterm_handler), |