summary refs log tree commit diff
path: root/tests/server.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-01-29 22:00:33 +0000
committerErik Johnston <erik@matrix.org>2019-01-29 22:00:33 +0000
commita696c48133d9f9a94f8b078aeacce0bef0d693b4 (patch)
tree8137f14c734d351f52af038265103f275276646a /tests/server.py
parentUpdate synapse/storage/events_worker.py (diff)
parentMerge pull request #4483 from matrix-org/erikj/event_v2 (diff)
downloadsynapse-a696c48133d9f9a94f8b078aeacce0bef0d693b4.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/redactions_eiah
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