From e820f9c4a7bcf887d77eb0df8946a59f32313e61 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 15 Sep 2014 00:56:06 -0400 Subject: actually broadcast the data being received --- ssh.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'ssh.py') diff --git a/ssh.py b/ssh.py index 127f1d7..b2d4a6d 100644 --- a/ssh.py +++ b/ssh.py @@ -16,18 +16,29 @@ class Connection(object): self.transport.add_server_key(paramiko.RSAKey(filename='test_rsa.key')) self.connection_id = connection_id self.publisher = publisher + self.initialized = False def run(self): self.transport.start_server(server=Server()) - chan = self.transport.accept(None) + self.chan = self.transport.accept(None) # XXX need to have the user select a stream, and then pass the stream's # id in here - contents = self.publisher.request_one("new_viewer", "some-random-id") - chan.send(contents) + self.publisher.notify("new_viewer", "some-stream") time.sleep(5) - chan.close() + self.chan.close() + + def msg_new_data(self, connection_id, prev_buf, data): + # XXX uncomment this once we implement stream selection + # if self.watching_id != connection_id: + # return + + if not self.initialized: + self.chan.send(prev_buf) + self.initialized = True + + self.chan.send(data) class Server(paramiko.ServerInterface): def check_channel_request(self, kind, chanid): -- cgit v1.2.3-54-g00ecf