diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2020-10-06 10:03:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-06 10:03:39 +0100 |
commit | 3e58ce72b42f2ae473c1e76a967548cd6fa7e2e6 (patch) | |
tree | 2dff08f323b6c787ab01cba939cf8487a4404b8e /synapse/http/server.py | |
parent | Update default room version to 6 (#8461) (diff) | |
download | synapse-3e58ce72b42f2ae473c1e76a967548cd6fa7e2e6.tar.xz |
Don't bother responding to client requests that have already disconnected (#8465)
This PR ports the quick fix from https://github.com/matrix-org/synapse/pull/2796 to further methods which handle media, URL preview and `/key/v2/server` requests. This prevents a harmless `ERROR` that comes up in the logs when we were unable to respond to a client request when the client had already disconnected. In this case we simply bail out if the client has already done so. This is the 'simple fix' as suggested by https://github.com/matrix-org/synapse/issues/5304#issuecomment-574740003. Fixes https://github.com/matrix-org/synapse/issues/6700 Fixes https://github.com/matrix-org/synapse/issues/5304
Diffstat (limited to '')
-rw-r--r-- | synapse/http/server.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py index 09ed74f6ce..00b98af3d4 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -651,6 +651,11 @@ def respond_with_json_bytes( Returns: twisted.web.server.NOT_DONE_YET if the request is still active. """ + if request._disconnected: + logger.warning( + "Not sending response to request %s, already disconnected.", request + ) + return request.setResponseCode(code) request.setHeader(b"Content-Type", b"application/json") |