diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-08-02 13:20:57 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-08-02 13:20:57 +0300 |
commit | bcf99f87e25d3702ec01595a5cf3e91c00cc6a98 (patch) | |
tree | b425438c319b92f902427267f53d8aafdde3ea2c /src/nxt_router.c | |
parent | 82c0304ab8f4fb2d406fe709639bee535b45d888 (diff) | |
download | unit-bcf99f87e25d3702ec01595a5cf3e91c00cc6a98.tar.gz unit-bcf99f87e25d3702ec01595a5cf3e91c00cc6a98.tar.bz2 |
Using port rpc in controller->router configuration update.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_router.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c index 40da942a..4cf476f6 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -53,9 +53,7 @@ static void nxt_router_conf_success(nxt_task_t *task, static void nxt_router_conf_error(nxt_task_t *task, nxt_router_temp_conf_t *tmcf); static void nxt_router_conf_send(nxt_task_t *task, - nxt_router_temp_conf_t *tmcf, u_char *start, size_t size); -static void nxt_router_conf_buf_completion(nxt_task_t *task, void *obj, - void *data); + nxt_router_temp_conf_t *tmcf, nxt_port_msg_type_t type); static void nxt_router_listen_sockets_sort(nxt_router_t *router, nxt_router_temp_conf_t *tmcf); @@ -490,7 +488,7 @@ nxt_router_conf_success(nxt_task_t *task, nxt_router_temp_conf_t *tmcf) nxt_debug(task, "temp conf count:%D", tmcf->count); if (--tmcf->count == 0) { - nxt_router_conf_send(task, tmcf, (u_char *) "OK", 2); + nxt_router_conf_send(task, tmcf, NXT_PORT_MSG_RPC_READY_LAST); } } @@ -526,40 +524,15 @@ nxt_router_conf_error(nxt_task_t *task, nxt_router_temp_conf_t *tmcf) nxt_mp_destroy(tmcf->conf->mem_pool); - nxt_router_conf_send(task, tmcf, (u_char *) "ERROR", 5); + nxt_router_conf_send(task, tmcf, NXT_PORT_MSG_RPC_ERROR); } static void nxt_router_conf_send(nxt_task_t *task, nxt_router_temp_conf_t *tmcf, - u_char *start, size_t size) + nxt_port_msg_type_t type) { - nxt_buf_t *b; - - b = nxt_buf_mem_alloc(tmcf->mem_pool, size, 0); - if (nxt_slow_path(b == NULL)) { - return; - } - - b->mem.free = nxt_cpymem(b->mem.free, start, size); - - b->parent = tmcf->mem_pool; - b->completion_handler = nxt_router_conf_buf_completion; - - nxt_port_socket_write(task, tmcf->port, NXT_PORT_MSG_DATA_LAST, -1, - tmcf->stream, 0, b); -} - - -static void -nxt_router_conf_buf_completion(nxt_task_t *task, void *obj, void *data) -{ - nxt_mp_t *mp; - - /* nxt_router_temp_conf_t mem pool. */ - mp = data; - - nxt_mp_destroy(mp); + nxt_port_socket_write(task, tmcf->port, type, -1, tmcf->stream, 0, NULL); } |