From 2903c7f2a0d532635d4ba78b3035c03f748bdf2d Mon Sep 17 00:00:00 2001 From: meejah Date: Fri, 2 Apr 2021 23:05:52 -0600 Subject: [PATCH] re-org + comments --- src/wormhole_transit_relay/test/common.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wormhole_transit_relay/test/common.py b/src/wormhole_transit_relay/test/common.py index a0b0c28..ed2e976 100644 --- a/src/wormhole_transit_relay/test/common.py +++ b/src/wormhole_transit_relay/test/common.py @@ -81,6 +81,8 @@ class ServerBase: _received = b"" connected = False + # override Protocol callbacks + def connectionMade(self): self.connected = True return Protocol.connectionMade(self) @@ -89,15 +91,17 @@ class ServerBase: self.connected = False return Protocol.connectionLost(self, reason) + def dataReceived(self, data): + self._received = self._received + data + + # ITransitClient API + def send(self, data): self.transport.write(data) def disconnect(self): self.transport.loseConnection() - def dataReceived(self, data): - self._received = self._received + data - def reset_received_data(self): self._received = b""