summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_router.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2017-10-10 19:15:08 +0300
committerValentin Bartenev <vbart@nginx.com>2017-10-10 19:15:08 +0300
commite4bea2c75c6643f84eaaaae8f7c474e00e943b8a (patch)
treec4bf6974a62f962ce19978b416eb65941ae4bd68 /src/nxt_router.c
parent93438a0d9e61bf382be3b648c0504fcda2f9c748 (diff)
downloadunit-e4bea2c75c6643f84eaaaae8f7c474e00e943b8a.tar.gz
unit-e4bea2c75c6643f84eaaaae8f7c474e00e943b8a.tar.bz2
Optimized application type handling.
Diffstat (limited to '')
-rw-r--r--src/nxt_router.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index d46dae72..32a3b9d3 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -960,7 +960,6 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
nxt_int_t ret;
nxt_str_t name;
nxt_app_t *app, *prev;
- nxt_app_type_t type;
nxt_sockaddr_t *sa;
nxt_conf_value_t *conf, *http;
nxt_conf_value_t *applications, *application;
@@ -1082,20 +1081,6 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
nxt_debug(task, "application language module: \"%s\"", lang->file);
- type = nxt_app_parse_type(&lang->type);
-
- if (type == NXT_APP_UNKNOWN) {
- nxt_log(task, NXT_LOG_CRIT, "unknown application type: \"%V\"",
- &lang->type);
- goto app_fail;
- }
-
- if (nxt_app_prepare_msg[type] == NULL) {
- nxt_log(task, NXT_LOG_CRIT, "unsupported application type: \"%V\"",
- &lang->type);
- goto app_fail;
- }
-
ret = nxt_thread_mutex_create(&app->mutex);
if (ret != NXT_OK) {
goto app_fail;
@@ -1107,12 +1092,12 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
app->name.length = name.length;
nxt_memcpy(app->name.start, name.start, name.length);
- app->type = type;
+ app->type = lang->type;
app->max_workers = apcf.workers;
app->timeout = apcf.timeout;
app->live = 1;
app->max_pending_responses = 2;
- app->prepare_msg = nxt_app_prepare_msg[type];
+ app->prepare_msg = nxt_app_prepare_msg[lang->type];
nxt_queue_insert_tail(&tmcf->apps, &app->link);