[Telepathy-commits] [telepathy-gabble/master] BytestreamS5B.get_data: check size of expected data

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Mon Mar 9 11:22:13 PDT 2009


---
 tests/twisted/bytestream.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/twisted/bytestream.py b/tests/twisted/bytestream.py
index e960097..e0a9b62 100644
--- a/tests/twisted/bytestream.py
+++ b/tests/twisted/bytestream.py
@@ -283,9 +283,16 @@ class BytestreamS5B(Bytestream):
         self._send_socks5_reply(id, jid)
 
     def get_data(self, size=0):
-       # TODO: check size
-       e = self.q.expect('s5b-data-received', transport=self.transport)
-       return e.data
+        binary = ''
+        received = False
+        while not received:
+            e = self.q.expect('s5b-data-received', transport=self.transport)
+            binary += e.data
+
+            if len(binary) >= size or size == 0:
+                received = True
+
+        return binary
 
     def wait_bytestream_closed(self):
         self.q.expect('s5b-connection-lost')
-- 
1.5.6.5




More information about the telepathy-commits mailing list