Implement MSC1708 (.well-known lookups for server routing) (#4489)

This commit is contained in:
Richard van der Hoff 2019-01-29 13:53:02 +00:00 committed by GitHub
parent 2562319821
commit 99e36d5e24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 470 additions and 21 deletions

View file

@ -354,6 +354,11 @@ class FakeTransport(object):
:type: twisted.internet.interfaces.IReactorTime
"""
_protocol = attr.ib(default=None)
"""The Protocol which is producing data for this transport. Optional, but if set
will get called back for connectionLost() notifications etc.
"""
disconnecting = False
buffer = attr.ib(default=b'')
producer = attr.ib(default=None)
@ -364,8 +369,12 @@ class FakeTransport(object):
def getHost(self):
return None
def loseConnection(self):
self.disconnecting = True
def loseConnection(self, reason=None):
logger.info("FakeTransport: loseConnection(%s)", reason)
if not self.disconnecting:
self.disconnecting = True
if self._protocol:
self._protocol.connectionLost(reason)
def abortConnection(self):
self.disconnecting = True