mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-20 22:14:18 -05:00
Merge pull request #3925 from matrix-org/erikj/fix_producers_unregistered
Fix spurious exceptions when client closes conncetion
This commit is contained in:
commit
94f7befc31
1
changelog.d/3925.misc
Normal file
1
changelog.d/3925.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix spurious exceptions when remote http client closes conncetion
|
@ -84,6 +84,17 @@ def wrap_json_request_handler(h):
|
|||||||
logger.info(
|
logger.info(
|
||||||
"%s SynapseError: %s - %s", request, code, e.msg
|
"%s SynapseError: %s - %s", request, code, e.msg
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Only respond with an error response if we haven't already started
|
||||||
|
# writing, otherwise lets just kill the connection
|
||||||
|
if request.startedWriting:
|
||||||
|
if request.transport:
|
||||||
|
try:
|
||||||
|
request.transport.abortConnection()
|
||||||
|
except Exception:
|
||||||
|
# abortConnection throws if the connection is already closed
|
||||||
|
pass
|
||||||
|
else:
|
||||||
respond_with_json(
|
respond_with_json(
|
||||||
request, code, e.error_dict(), send_cors=True,
|
request, code, e.error_dict(), send_cors=True,
|
||||||
pretty_print=_request_user_agent_is_curl(request),
|
pretty_print=_request_user_agent_is_curl(request),
|
||||||
@ -100,6 +111,16 @@ def wrap_json_request_handler(h):
|
|||||||
request,
|
request,
|
||||||
f.getTraceback().rstrip(),
|
f.getTraceback().rstrip(),
|
||||||
)
|
)
|
||||||
|
# Only respond with an error response if we haven't already started
|
||||||
|
# writing, otherwise lets just kill the connection
|
||||||
|
if request.startedWriting:
|
||||||
|
if request.transport:
|
||||||
|
try:
|
||||||
|
request.transport.abortConnection()
|
||||||
|
except Exception:
|
||||||
|
# abortConnection throws if the connection is already closed
|
||||||
|
pass
|
||||||
|
else:
|
||||||
respond_with_json(
|
respond_with_json(
|
||||||
request,
|
request,
|
||||||
500,
|
500,
|
||||||
|
Loading…
Reference in New Issue
Block a user