summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_application.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-08-31 00:42:12 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-08-31 00:42:12 +0300
commit61606835448554a7ee9a4431d732e1f2a9318376 (patch)
tree171841cea56c4fdbd0fd1bb2473e18d3a96cda3a /src/nxt_application.c
parent3f10b05de995099bf7551b17f5d8d38efe8b4fc5 (diff)
downloadunit-61606835448554a7ee9a4431d732e1f2a9318376.tar.gz
unit-61606835448554a7ee9a4431d732e1f2a9318376.tar.bz2
Introduced module compatibility vector.
Diffstat (limited to 'src/nxt_application.c')
-rw-r--r--src/nxt_application.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c
index d9245688..c1a3bb77 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -37,6 +37,11 @@ static nxt_http_fields_hash_t *nxt_app_request_fields_hash;
static nxt_application_module_t *nxt_app;
+static uint32_t compat[] = {
+ NXT_VERNUM,
+};
+
+
nxt_int_t
nxt_discovery_start(nxt_task_t *task, void *data)
{
@@ -195,18 +200,29 @@ nxt_discovery_module(nxt_task_t *task, nxt_mp_t *mp, nxt_array_t *modules,
app = dlsym(dl, "nxt_app_module");
if (app != NULL) {
- nxt_log(task, NXT_LOG_NOTICE, "module: %V \"%s\"",
- &app->version, name);
+ nxt_log(task, NXT_LOG_NOTICE, "module: %V %V \"%s\"",
+ &app->type, &app->version, name);
+
+ if (app->compat_length != sizeof(compat)
+ || nxt_memcmp(app->compat, compat, sizeof(compat)) != 0)
+ {
+ nxt_log(task, NXT_LOG_NOTICE, "incompatible module %s", name);
+
+ goto done;
+ }
module = modules->elts;
n = modules->nelts;
for (i = 0; i < n; i++) {
- if (nxt_strstr_eq(&app->version, &module[i].version)) {
+ if (nxt_strstr_eq(&app->type, &module[i].type)
+ && nxt_strstr_eq(&app->version, &module[i].version))
+ {
nxt_log(task, NXT_LOG_NOTICE,
"ignoring %s module with the same "
- "application language version %V as in %s",
- name, &module[i].version, &module[i].file);
+ "application language version %V %V as in %s",
+ name, &module[i].type, &module[i].version,
+ &module[i].file);
goto done;
}