mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-07 22:21:47 +00:00
added --write-errors-tolerance and --write-errors-exception-only
This commit is contained in:
@@ -41,6 +41,12 @@
|
||||
#define uwsgi_py_write_set_exception(x) PyErr_SetString(PyExc_IOError, "write error");
|
||||
#define uwsgi_py_write_exception(x) uwsgi_py_write_set_exception(x); PyErr_Print();
|
||||
|
||||
|
||||
#define uwsgi_py_check_write_errors if (wsgi_req->write_errors > 0 && uwsgi.write_errors_exception_only) {\
|
||||
uwsgi_py_write_set_exception(wsgi_req);\
|
||||
}\
|
||||
else if (wsgi_req->write_errors > uwsgi.write_errors_tolerance)\
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int);
|
||||
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t);
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ int uwsgi_response_subhandler_web3(struct wsgi_request *wsgi_req) {
|
||||
UWSGI_RELEASE_GIL
|
||||
wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, content, content_len);
|
||||
UWSGI_GET_GIL
|
||||
if (wsgi_req->write_errors > 0) {
|
||||
uwsgi_py_check_write_errors {
|
||||
uwsgi_py_write_exception(wsgi_req);
|
||||
}
|
||||
goto clear;
|
||||
@@ -215,7 +215,7 @@ int uwsgi_response_subhandler_web3(struct wsgi_request *wsgi_req) {
|
||||
UWSGI_RELEASE_GIL
|
||||
wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, content, content_len);
|
||||
UWSGI_GET_GIL
|
||||
if (wsgi_req->write_errors > 0) {
|
||||
uwsgi_py_check_write_errors {
|
||||
uwsgi_py_write_exception(wsgi_req);
|
||||
Py_DECREF(pychunk);
|
||||
goto clear;
|
||||
|
||||
@@ -278,6 +278,8 @@ PyObject *py_uwsgi_write(PyObject * self, PyObject * args) {
|
||||
UWSGI_RELEASE_GIL
|
||||
wsgi_req->response_size = wsgi_req->socket->proto_write(wsgi_req, content, len);
|
||||
UWSGI_GET_GIL
|
||||
// this is a special case for the write callable
|
||||
// no need to honout write-errors-exception-only
|
||||
if (wsgi_req->write_errors > 0) {
|
||||
uwsgi_py_write_set_exception(wsgi_req);
|
||||
return NULL;
|
||||
|
||||
@@ -169,7 +169,7 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) {
|
||||
UWSGI_RELEASE_GIL
|
||||
wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, content, content_len);
|
||||
UWSGI_GET_GIL
|
||||
if (wsgi_req->write_errors > 0) {
|
||||
uwsgi_py_check_write_errors {
|
||||
uwsgi_py_write_exception(wsgi_req);
|
||||
}
|
||||
goto clear;
|
||||
@@ -255,7 +255,7 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) {
|
||||
UWSGI_RELEASE_GIL
|
||||
wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, content, content_len);
|
||||
UWSGI_GET_GIL
|
||||
if (wsgi_req->write_errors > 0) {
|
||||
uwsgi_py_check_write_errors {
|
||||
uwsgi_py_write_exception(wsgi_req);
|
||||
Py_DECREF(pychunk);
|
||||
goto clear;
|
||||
|
||||
Reference in New Issue
Block a user