From 6f1b08762d3a1d627dbb05842e598303ffddb53f Mon Sep 17 00:00:00 2001 From: "roberto@debian32" Date: Mon, 9 May 2011 09:43:55 +0200 Subject: [PATCH] adde fixup hook handler --- plugins/python/python_plugin.c | 10 +++++++--- uwsgi.c | 7 +++++++ uwsgi.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 4ededc8e..3e2b02e1 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -132,9 +132,6 @@ int uwsgi_python_init() { uwsgi_log("Python main interpreter initialized at %p\n", up.main_thread); - // add the hacky modifier1 30 - uwsgi.p[30]->request = uwsgi.p[0]->request; - return 1; } @@ -1035,6 +1032,11 @@ void uwsgi_python_resume(struct wsgi_request *wsgi_req) { } +void uwsgi_python_fixup() { + // set hacky modifier 30 + uwsgi.p[30] = uwsgi.p[0]; +} + struct uwsgi_plugin python_plugin = { .name = "python", @@ -1049,6 +1051,8 @@ struct uwsgi_plugin python_plugin = { .after_request = uwsgi_after_request_wsgi, .init_apps = uwsgi_python_init_apps, + .fixup = uwsgi_python_fixup, + .mount_app = uwsgi_python_mount_app, .enable_threads = uwsgi_python_enable_threads, diff --git a/uwsgi.c b/uwsgi.c index b0a0d47d..924da681 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -2091,6 +2091,13 @@ int uwsgi_start(void *v_argv) { //initialization done + // run fixup handler + for (i = 0; i < 0xFF; i++) { + if (uwsgi.p[i]->fixup) { + uwsgi.p[i]->fixup(); + } + } + if (uwsgi.chdir2) { if (chdir(uwsgi.chdir2)) { uwsgi_error("chdir()"); diff --git a/uwsgi.h b/uwsgi.h index 5ad8164b..49280e77 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -559,6 +559,7 @@ struct uwsgi_plugin { int (*request) (struct wsgi_request *); void (*after_request) (struct wsgi_request *); void (*init_apps) (void); + void (*fixup) (void); int (*mount_app) (char *, char *); int (*manage_udp) (char *, int, char *, int); int (*manage_xml) (char *, char *);