Catch the exceptions thrown by twisted when you write to a closed connection

This commit is contained in:
Mark Haines 2016-02-12 13:46:59 +00:00
parent ec0f3836ff
commit 58c9f20692
5 changed files with 33 additions and 11 deletions

View file

@ -16,7 +16,7 @@
from .thumbnailer import Thumbnailer
from synapse.http.matrixfederationclient import MatrixFederationHttpClient
from synapse.http.server import respond_with_json
from synapse.http.server import respond_with_json, finish_request
from synapse.util.stringutils import random_string
from synapse.api.errors import (
cs_error, Codes, SynapseError
@ -238,7 +238,7 @@ class BaseMediaResource(Resource):
with open(file_path, "rb") as f:
yield FileSender().beginFileTransfer(f, request)
request.finish()
finish_request(request)
else:
self._respond_404(request)