mirror of https://git.kore.io/kore.git
Improve iterator support for Python req.response().
If the connection on which we are about to send the response was marked as disconnecting, do not go ahead and hook into the disconnect callback (it will never be called, it is already disconnecting). Instead just return, the connection will be removed anyway.
This commit is contained in:
parent
93b1d621d7
commit
89e58fa474
|
@ -3159,11 +3159,14 @@ pyhttp_response(struct pyhttp_request *pyreq, PyObject *args)
|
||||||
} else if (obj == Py_None) {
|
} else if (obj == Py_None) {
|
||||||
http_response(pyreq->req, status, NULL, 0);
|
http_response(pyreq->req, status, NULL, 0);
|
||||||
} else {
|
} else {
|
||||||
|
c = pyreq->req->owner;
|
||||||
|
if (c->state == CONN_STATE_DISCONNECTING) {
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if ((iterator = PyObject_GetIter(obj)) == NULL)
|
if ((iterator = PyObject_GetIter(obj)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
c = pyreq->req->owner;
|
|
||||||
|
|
||||||
iterobj = kore_pool_get(&iterobj_pool);
|
iterobj = kore_pool_get(&iterobj_pool);
|
||||||
iterobj->iterator = iterator;
|
iterobj->iterator = iterator;
|
||||||
iterobj->connection = c;
|
iterobj->connection = c;
|
||||||
|
|
Loading…
Reference in New Issue