mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-27 08:40:08 +00:00
python fixes and optimizations
This commit is contained in:
@@ -286,12 +286,11 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
|
||||
wsgi_req->async_result = wi->request_subhandler(wsgi_req, wi);
|
||||
|
||||
|
||||
if (wsgi_req->async_result) {
|
||||
|
||||
|
||||
UWSGI_RELEASE_GIL
|
||||
while ( (*wi->response_subhandler)(wsgi_req) != UWSGI_OK) {
|
||||
while ( wi->response_subhandler(wsgi_req) != UWSGI_OK) {
|
||||
wsgi_req->switches++;
|
||||
#ifdef UWSGI_ASYNC
|
||||
if (uwsgi.async > 1) {
|
||||
@@ -336,7 +335,6 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
close(tmp_stderr);
|
||||
}
|
||||
|
||||
|
||||
clear:
|
||||
|
||||
UWSGI_GET_GIL
|
||||
@@ -353,10 +351,9 @@ clear:
|
||||
|
||||
UWSGI_RELEASE_GIL
|
||||
|
||||
clear2:
|
||||
clear2:
|
||||
|
||||
|
||||
return UWSGI_OK;
|
||||
return UWSGI_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ PyObject *py_uwsgi_spit(PyObject * self, PyObject * args) {
|
||||
uwsgi_error("writev()");
|
||||
}
|
||||
|
||||
//uwsgi_log("%d %p\n", wsgi_req->poll.fd, up.wsgi_writeout);
|
||||
Py_INCREF(up.wsgi_writeout);
|
||||
|
||||
|
||||
|
||||
@@ -110,15 +110,15 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) {
|
||||
|
||||
UWSGI_GET_GIL
|
||||
|
||||
// return or yield ?
|
||||
if (PyString_Check((PyObject *)wsgi_req->async_result)) {
|
||||
if ((wsize = write(wsgi_req->poll.fd, PyString_AsString(wsgi_req->async_result), PyString_Size(wsgi_req->async_result))) < 0) {
|
||||
uwsgi_error("write()");
|
||||
goto clear;
|
||||
}
|
||||
wsgi_req->response_size += wsize;
|
||||
// return or yield ?
|
||||
if (PyString_Check((PyObject *)wsgi_req->async_result)) {
|
||||
if ((wsize = write(wsgi_req->poll.fd, PyString_AsString(wsgi_req->async_result), PyString_Size(wsgi_req->async_result))) < 0) {
|
||||
uwsgi_error("write()");
|
||||
goto clear;
|
||||
}
|
||||
wsgi_req->response_size += wsize;
|
||||
goto clear;
|
||||
}
|
||||
|
||||
#ifdef UWSGI_SENDFILE
|
||||
if (wsgi_req->sendfile_obj == wsgi_req->async_result && wsgi_req->sendfile_fd != -1) {
|
||||
@@ -181,7 +181,7 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) {
|
||||
|
||||
Py_DECREF(pychunk);
|
||||
UWSGI_RELEASE_GIL
|
||||
return UWSGI_AGAIN;
|
||||
return UWSGI_AGAIN;
|
||||
|
||||
clear:
|
||||
if (wsgi_req->sendfile_fd != -1) {
|
||||
@@ -214,7 +214,7 @@ clear2:
|
||||
#endif
|
||||
|
||||
UWSGI_RELEASE_GIL
|
||||
return UWSGI_OK;
|
||||
return UWSGI_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user