diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-09-14 23:37:56 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-09-14 23:37:56 -0400 |
commit | c6633dae0e1886ac415dcb74fa0b2bde1ea48e66 (patch) | |
tree | ef27b560671ac1f7c1cac7ec91c027e8bff020ef /ssh.py | |
parent | 033673ac065a189bc611af689c964a7f75a3a183 (diff) | |
download | python-termcast-server-c6633dae0e1886ac415dcb74fa0b2bde1ea48e66.tar.gz python-termcast-server-c6633dae0e1886ac415dcb74fa0b2bde1ea48e66.zip |
introduce a pubsub system for communication
Diffstat (limited to 'ssh.py')
-rw-r--r-- | ssh.py | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -11,20 +11,19 @@ class Handler(object): pass class Connection(object): - def __init__(self, client, connection_id): + def __init__(self, client, connection_id, publisher): self.transport = paramiko.Transport(client) self.transport.add_server_key(paramiko.RSAKey(filename='test_rsa.key')) + self.connection_id = connection_id + self.publisher = publisher - def run(self, termcast_connections): + def run(self): self.transport.start_server(server=Server()) chan = self.transport.accept(None) - if len(termcast_connections) > 0: - connection = termcast_connections.values().__iter__().__next__() - term_contents = connection.handler.get_term() - chan.send(term_contents.replace("\n", "\r\n")) - else: - chan.send("no data for doy\r\n") + # XXX need to have the user select a stream, and then pass the stream's + # id in here + self.publisher.publish("new_viewer", chan, "some-random-id") time.sleep(5) chan.close() @@ -46,4 +45,3 @@ class Server(paramiko.ServerInterface): def get_allowed_auths(self, username): return "password" - |