summary refs log tree commit diff
path: root/tests/server.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-01-29 13:53:02 +0000
committerGitHub <noreply@github.com>2019-01-29 13:53:02 +0000
commit99e36d5e243059a4c92a769a2920714b2d4c84d9 (patch)
treeeb0a50ca1ffe84f2e020313d9426d9484d118b55 /tests/server.py
parentMerge pull request #4510 from matrix-org/erikj/fixup_compute_event_signature (diff)
downloadsynapse-99e36d5e243059a4c92a769a2920714b2d4c84d9.tar.xz
Implement MSC1708 (.well-known lookups for server routing) (#4489)
Diffstat (limited to 'tests/server.py')
-rw-r--r--tests/server.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/server.py b/tests/server.py
index 6adcc73f91..3d7ae9875c 100644
--- a/tests/server.py
+++ b/tests/server.py
@@ -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