diff --git a/plugins.c b/plugins.c index 1bbee0f1..cd187229 100644 --- a/plugins.c +++ b/plugins.c @@ -2,25 +2,6 @@ extern struct uwsgi_server uwsgi; -void embed_plugins() { - -#ifdef UWSGI_EMBED_PLUGIN_PSGI - if (uwsgi.plugin_arg_psgi) - uwsgi_load_plugin(5, "psgi_plugin.so", uwsgi.plugin_arg_psgi, 0); -#endif - -#ifdef UWSGI_EMBED_PLUGIN_LUA - if (uwsgi.plugin_arg_lua) - uwsgi_load_plugin(6, "lua_plugin.so", uwsgi.plugin_arg_lua, 0); -#endif - -#ifdef UWSGI_EMBED_PLUGIN_RACK - if (uwsgi.plugin_arg_rack) - uwsgi_load_plugin(7, "rack_plugin.so", uwsgi.plugin_arg_rack, 0); -#endif - -} - int uwsgi_load_plugin(int modifier, char *plugin, char *pargs, int absolute) { void *plugin_handle; @@ -28,6 +9,38 @@ int uwsgi_load_plugin(int modifier, char *plugin, char *pargs, int absolute) { char *plugin_name; char *plugin_entry_symbol; struct uwsgi_plugin *up; + int i; + + for (i = 0; i < 0xFF; i++) { + if (uwsgi.p[i]->name) { + if (!strcmp(plugin, uwsgi.p[i]->name)) { + uwsgi_log("%s plugin already available\n", plugin); + return 0; + } + } + if (uwsgi.p[i]->alias) { + if (!strcmp(plugin, uwsgi.p[i]->alias)) { + uwsgi_log("%s plugin already available\n", plugin); + return 0; + } + } + } + + for(i=0;iname) { + if (!strcmp(plugin, uwsgi.gp[i]->name)) { + uwsgi_log("%s plugin already available\n", plugin); + return 0; + } + } + if (uwsgi.gp[i]->alias) { + if (!strcmp(plugin, uwsgi.gp[i]->alias)) { + uwsgi_log("%s plugin already available\n", plugin); + return 0; + } + } + } if (absolute) { plugin_name = malloc(strlen(plugin) + 1); @@ -58,7 +71,4 @@ int uwsgi_load_plugin(int modifier, char *plugin, char *pargs, int absolute) { } return 0; - - - return -1; } diff --git a/plugins/erlang/erlang.c b/plugins/erlang/erlang.c index d3f0b550..2adbbedf 100644 --- a/plugins/erlang/erlang.c +++ b/plugins/erlang/erlang.c @@ -447,6 +447,7 @@ int erlang_opt(int i, char *optarg) { struct uwsgi_plugin erlang_plugin = { + .name = "erlang", .options = erlang_options, .manage_opt = erlang_opt, .init = erlang_init, diff --git a/plugins/fastrouter/fastrouter.c b/plugins/fastrouter/fastrouter.c index d73c39ad..1424b749 100644 --- a/plugins/fastrouter/fastrouter.c +++ b/plugins/fastrouter/fastrouter.c @@ -582,6 +582,7 @@ int fastrouter_opt(int i, char *optarg) { struct uwsgi_plugin fastrouter_plugin = { + .name = "fastrouter", .options = fastrouter_options, .manage_opt = fastrouter_opt, .init = fastrouter_init, diff --git a/plugins/http/http.c b/plugins/http/http.c index 8d356bb4..a41530af 100644 --- a/plugins/http/http.c +++ b/plugins/http/http.c @@ -934,6 +934,7 @@ int http_opt(int i, char *optarg) { struct uwsgi_plugin http_plugin = { + .name = "http", .options = http_options, .manage_opt = http_opt, .help = http_help, diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 4b4e8ccf..edb0ce36 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -85,7 +85,6 @@ int uwsgi_python_init() { uwsgi_log("Python version: %.*s %s\n", pyversion-Py_GetVersion(), Py_GetVersion(), Py_GetCompiler()+1); if (up.home != NULL) { - uwsgi_log("Setting PythonHome to %s...\n", up.home); #ifdef PYTHREE wchar_t *wpyhome; wpyhome = malloc((sizeof(wchar_t) * strlen(up.home)) + 2); @@ -99,6 +98,7 @@ int uwsgi_python_init() { #else Py_SetPythonHome(up.home); #endif + uwsgi_log("Set PythonHome to %s\n", up.home); } #ifdef PYTHREE @@ -1004,6 +1004,7 @@ void uwsgi_python_resume(struct wsgi_request *wsgi_req) { struct uwsgi_plugin python_plugin = { .name = "python", + .alias = "python", .modifier1 = 0, .init = uwsgi_python_init, .post_fork = uwsgi_python_post_fork, diff --git a/uwsgi.h b/uwsgi.h index f1b7c06a..b119e5e0 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -479,6 +479,7 @@ struct uwsgi_server; struct uwsgi_plugin { const char *name; + const char *alias; uint8_t modifier1; void *data; int (*init) (void); @@ -1378,8 +1379,6 @@ void uwsgi_log_verbose(const char *,...); int uwsgi_load_plugin(int, char *, char *, int); -void embed_plugins(void); - int unconfigured_hook(struct wsgi_request *);