Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not compatible with Tornado 6.0 #10

Open
rannof opened this issue Jun 18, 2019 · 1 comment
Open

not compatible with Tornado 6.0 #10

rannof opened this issue Jun 18, 2019 · 1 comment

Comments

@rannof
Copy link

rannof commented Jun 18, 2019

IOStream.read_until_close does not accept callbacks anymore. Can you please update the code?

@rannof
Copy link
Author

rannof commented Jun 19, 2019

Suggested patch:

diff --git a/torstomp/__init__.py b/torstomp/__init__.py
index 65551f6..5bc2ea8 100644
--- a/torstomp/__init__.py
+++ b/torstomp/__init__.py
@@ -59,22 +59,24 @@ class TorStomp(object):
             return
 
         self.stream.set_close_callback(self._on_disconnect_socket)
-        self.stream.read_until_close(
-            streaming_callback=self._on_data,
-            callback=self._on_data)
-
         self.connected = True
         self._disconnecting = False
         self._reconnect_attempts = 0
         self._protocol.reset()
 
         yield self._send_frame('CONNECT', self._connect_headers)
-
+        self.logger.info('Stomp connect sent')
         for subscription in self._subscriptions.values():
             yield self._send_subscribe_frame(subscription)
-
+            self.logger.info('Stomp subscribe sent')
         if self._on_connect:
             self._on_connect()
+        #self.stream.read_until_close()
+        while not self.stream.closed():
+            buf = yield self.stream.read_until(b'\x00\n', 10e6)
+            self._on_data(buf)
+            yield None
+        self.logger.info('done.')
 
     def subscribe(self, destination, ack='auto', extra_headers={},
                   callback=None):
@@ -160,7 +162,6 @@ class TorStomp(object):
     def _on_data(self, data):
         if not data:
             return
-
         self._protocol.add_data(data)
 
         frames = self._protocol.pop_frames()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant