diff options
author | Will Hunt <will@half-shot.uk> | 2018-05-03 12:31:47 +0100 |
---|---|---|
committer | Will Hunt <will@half-shot.uk> | 2018-05-03 12:31:47 +0100 |
commit | 2e7a94c36ba75a94114e4a9fb1aa6d4e3444e8b4 (patch) | |
tree | 2b93fbfa731ddbcb475f0b9fb3ff1527b451dbf5 /synapse/http/endpoint.py | |
parent | Merge pull request #1921 from matrix-org/rav/fix_key_changes (diff) | |
download | synapse-2e7a94c36ba75a94114e4a9fb1aa6d4e3444e8b4.tar.xz |
Don't abortConnection() if the transport connection has already closed.
Diffstat (limited to '')
-rw-r--r-- | synapse/http/endpoint.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/http/endpoint.py b/synapse/http/endpoint.py index d8923c9abb..564ae4c10d 100644 --- a/synapse/http/endpoint.py +++ b/synapse/http/endpoint.py @@ -113,10 +113,15 @@ class _WrappedConnection(object): if time.time() - self.last_request >= 2.5 * 60: self.abort() # Abort the underlying TLS connection. The abort() method calls - # loseConnection() on the underlying TLS connection which tries to + # loseConnection() on the TLS connection which tries to # shutdown the connection cleanly. We call abortConnection() - # since that will promptly close the underlying TCP connection. - self.transport.abortConnection() + # since that will promptly close the TLS connection. + # + # In Twisted >18.4; the TLS connection will be None if it has closed + # which will make abortConnection() throw. Check that the TLS connection + # is not None before trying to close it. + if self.transport.getHandle() is not None: + self.transport.abortConnection() def request(self, request): self.last_request = time.time() |