implemented reliable gevent non-blocking writes

This commit is contained in:
Roberto De Ioris
2012-10-22 08:34:37 +02:00
parent c487fb0cf0
commit 29ce04adce
4 changed files with 124 additions and 11 deletions
+8
View File
@@ -9,6 +9,12 @@ extern struct http_status_codes hsc[];
extern PyTypeObject uwsgi_InputType;
void python_simple_hook_write_string(struct wsgi_request *wsgi_req, PyObject *str) {
UWSGI_RELEASE_GIL
wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, PyString_AsString(str), PyString_Size(str));
UWSGI_GET_GIL
}
void uwsgi_opt_pythonpath(char *opt, char *value, void *foobar) {
int i;
@@ -232,6 +238,8 @@ pep405:
up.wsgi_spitout = PyCFunction_New(uwsgi_spit_method, NULL);
up.wsgi_writeout = PyCFunction_New(uwsgi_write_method, NULL);
up.hook_write_string = python_simple_hook_write_string;
up.main_thread = PyThreadState_Get();
// by default set a fake GIL (little impact on performance)