mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-01 11:15:57 +00:00
first round of protocol parsers optimizations
preliminary api for language-independent body read another step completed body read language independent implementation ported gevent to the new read/write api ported websockets to the new read/write api removed channels subsystem removed channels subsystem ported lua to the new read/write api fixed post-buffering readline is still broken improved request body readline very difficult test for readline()/read() combo passed other improvements in postbuffering/read/readline ported --http-socket to the new api added X-Forwarded-SSL management removed old api more refactoring ported the RACK plugin to the new api ported psgi plugin to the new api defintely removed clustering simpified ifdel hell simpified ifdef hell removed useless configuration options
This commit is contained in:
@@ -136,7 +136,6 @@ struct uwsgi_option uwsgi_python_options[] = {
|
||||
{"py", required_argument, 0, "run a python script in the uWSGI environment", uwsgi_opt_pyrun, NULL, 0},
|
||||
{"pyrun", required_argument, 0, "run a python script in the uWSGI environment", uwsgi_opt_pyrun, NULL, 0},
|
||||
|
||||
#ifdef UWSGI_THREADING
|
||||
#ifndef UWSGI_PYPY
|
||||
{"py-tracebacker", required_argument, 0, "enable the uWSGI python tracebacker", uwsgi_opt_set_str, &up.tracebacker, UWSGI_OPT_THREADS|UWSGI_OPT_MASTER},
|
||||
#endif
|
||||
@@ -145,7 +144,6 @@ struct uwsgi_option uwsgi_python_options[] = {
|
||||
{"python-auto-reload", required_argument, 0, "monitor python modules mtime to trigger reload (use only in development)", uwsgi_opt_set_int, &up.auto_reload, UWSGI_OPT_THREADS|UWSGI_OPT_MASTER},
|
||||
{"python-autoreload", required_argument, 0, "monitor python modules mtime to trigger reload (use only in development)", uwsgi_opt_set_int, &up.auto_reload, UWSGI_OPT_THREADS|UWSGI_OPT_MASTER},
|
||||
{"py-auto-reload-ignore", required_argument, 0, "ignore the specified module during auto-reload scan (can be specified multiple times)", uwsgi_opt_add_string_list, &up.auto_reload_ignore, UWSGI_OPT_THREADS|UWSGI_OPT_MASTER},
|
||||
#endif
|
||||
|
||||
{"wsgi-env-behaviour", required_argument, 0, "set the strategy for allocating/deallocating the WSGI env", uwsgi_opt_set_str, &up.wsgi_env_behaviour, 0},
|
||||
{"wsgi-env-behavior", required_argument, 0, "set the strategy for allocating/deallocating the WSGI env", uwsgi_opt_set_str, &up.wsgi_env_behaviour, 0},
|
||||
@@ -249,9 +247,6 @@ pep405:
|
||||
up.wsgi_spitout = PyCFunction_New(uwsgi_spit_method, NULL);
|
||||
up.wsgi_writeout = PyCFunction_New(uwsgi_write_method, NULL);
|
||||
|
||||
up.hook_wsgi_input_read = uwsgi_python_hook_simple_input_read;
|
||||
up.hook_wsgi_input_readline = uwsgi_python_hook_simple_input_readline;
|
||||
|
||||
up.main_thread = PyThreadState_Get();
|
||||
|
||||
// by default set a fake GIL (little impact on performance)
|
||||
@@ -307,12 +302,9 @@ void uwsgi_python_atexit() {
|
||||
if (uwsgi.workers[uwsgi.mywid].busy)
|
||||
return;
|
||||
|
||||
#ifdef UWSGI_ASYNC
|
||||
// managing atexit in async mode is a real pain...skip it for now
|
||||
if (uwsgi.async > 1)
|
||||
return;
|
||||
#endif
|
||||
|
||||
realstuff:
|
||||
|
||||
// this time we use this higher level function
|
||||
@@ -326,7 +318,6 @@ realstuff:
|
||||
PyGILState_Ensure();
|
||||
|
||||
// no need to worry about freeing memory
|
||||
#ifdef UWSGI_EMBEDDED
|
||||
PyObject *uwsgi_dict = get_uwsgi_pydict("uwsgi");
|
||||
if (uwsgi_dict) {
|
||||
PyObject *ae = PyDict_GetItemString(uwsgi_dict, "atexit");
|
||||
@@ -334,7 +325,6 @@ realstuff:
|
||||
python_call(ae, PyTuple_New(0), 0, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// this part is a 1:1 copy of mod_wsgi 3.x
|
||||
// it is required to fix some atexit bug with python 3
|
||||
@@ -352,15 +342,12 @@ realstuff:
|
||||
|
||||
void uwsgi_python_post_fork() {
|
||||
|
||||
#ifdef UWSGI_SPOOLER
|
||||
if (uwsgi.i_am_a_spooler) {
|
||||
UWSGI_GET_GIL
|
||||
}
|
||||
#endif
|
||||
|
||||
uwsgi_python_reset_random_seed();
|
||||
|
||||
#ifdef UWSGI_EMBEDDED
|
||||
// call the post_fork_hook
|
||||
PyObject *uwsgi_dict = get_uwsgi_pydict("uwsgi");
|
||||
if (uwsgi_dict) {
|
||||
@@ -370,10 +357,8 @@ void uwsgi_python_post_fork() {
|
||||
}
|
||||
}
|
||||
PyErr_Clear();
|
||||
#endif
|
||||
|
||||
if (uwsgi.mywid > 0) {
|
||||
#ifdef UWSGI_THREADING
|
||||
if (up.auto_reload) {
|
||||
// spawn the reloader thread
|
||||
pthread_t par_tid;
|
||||
@@ -385,7 +370,6 @@ void uwsgi_python_post_fork() {
|
||||
pthread_t ptb_tid;
|
||||
pthread_create(&ptb_tid, NULL, uwsgi_python_tracebacker_thread, NULL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -572,7 +556,6 @@ next:
|
||||
|
||||
|
||||
|
||||
#ifdef UWSGI_EMBEDDED
|
||||
PyDoc_STRVAR(uwsgi_py_doc, "uWSGI api module.");
|
||||
|
||||
#ifdef PYTHREE
|
||||
@@ -671,7 +654,6 @@ void init_uwsgi_embedded_module() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UWSGI_SPOOLER
|
||||
if (uwsgi.spoolers) {
|
||||
int sc = 0;
|
||||
struct uwsgi_spooler *uspool = uwsgi.spoolers;
|
||||
@@ -693,9 +675,6 @@ void init_uwsgi_embedded_module() {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (PyDict_SetItemString(up.embedded_dict, "SPOOL_RETRY", PyInt_FromLong(-1))) {
|
||||
PyErr_Print();
|
||||
@@ -850,12 +829,9 @@ void init_uwsgi_embedded_module() {
|
||||
|
||||
init_uwsgi_module_advanced(new_uwsgi_module);
|
||||
|
||||
#ifdef UWSGI_SPOOLER
|
||||
if (uwsgi.spoolers) {
|
||||
init_uwsgi_module_spooler(new_uwsgi_module);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (uwsgi.sharedareasize > 0 && uwsgi.sharedarea) {
|
||||
init_uwsgi_module_sharedarea(new_uwsgi_module);
|
||||
@@ -869,17 +845,14 @@ void init_uwsgi_embedded_module() {
|
||||
init_uwsgi_module_queue(new_uwsgi_module);
|
||||
}
|
||||
|
||||
#ifdef UWSGI_SNMP
|
||||
if (uwsgi.snmp) {
|
||||
init_uwsgi_module_snmp(new_uwsgi_module);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (up.extension) {
|
||||
up.extension();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -995,15 +968,9 @@ void uwsgi_python_spooler_init(void) {
|
||||
// from a python-programmer point of view it is a hack/cheat but it does not violate the WSGI standard
|
||||
// and it is a bit faster than the "holy" allocator
|
||||
void *uwsgi_python_create_env_cheat(struct wsgi_request *wsgi_req, struct uwsgi_app *wi) {
|
||||
#ifdef UWSGI_ASYNC
|
||||
wsgi_req->async_args = wi->args[wsgi_req->async_id];
|
||||
Py_INCREF((PyObject *)wi->environ[wsgi_req->async_id]);
|
||||
return wi->environ[wsgi_req->async_id];
|
||||
#else
|
||||
wsgi_req->async_args = wi->args;
|
||||
Py_INCREF((PyObject *)wi->environ);
|
||||
return wi->environ;
|
||||
#endif
|
||||
}
|
||||
|
||||
void uwsgi_python_destroy_env_cheat(struct wsgi_request *wsgi_req) {
|
||||
@@ -1045,14 +1012,10 @@ void uwsgi_python_preinit_apps() {
|
||||
|
||||
init_pyargv();
|
||||
|
||||
#ifdef UWSGI_EMBEDDED
|
||||
init_uwsgi_embedded_module();
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef UWSGI_EMBEDDED
|
||||
uwsgi_init_symbol_import();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (up.test_module != NULL) {
|
||||
@@ -1206,7 +1169,6 @@ next:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UWSGI_EMBEDDED
|
||||
PyObject *uwsgi_dict = get_uwsgi_pydict("uwsgi");
|
||||
if (uwsgi_dict) {
|
||||
up.after_req_hook = PyDict_GetItemString(uwsgi_dict, "after_req_hook");
|
||||
@@ -1216,8 +1178,6 @@ next:
|
||||
Py_INCREF(up.after_req_hook_args);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// lazy ?
|
||||
if (uwsgi.mywid > 0) {
|
||||
UWSGI_RELEASE_GIL;
|
||||
@@ -1319,7 +1279,6 @@ void uwsgi_python_init_thread(int core_id) {
|
||||
|
||||
}
|
||||
|
||||
#ifdef UWSGI_THREADING
|
||||
int uwsgi_check_python_mtime(PyObject *times_dict, char *filename) {
|
||||
struct stat st;
|
||||
|
||||
@@ -1463,7 +1422,6 @@ void *uwsgi_python_autoreloader_thread(void *foobar) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef UWSGI_PYPY
|
||||
void uwsgi_python_suspend(struct wsgi_request *wsgi_req) {
|
||||
|
||||
Reference in New Issue
Block a user