aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-09-15 01:48:44 -0400
committerJesse Luehrs <doy@tozt.net>2014-09-15 01:48:44 -0400
commitf144cdf8adcb233a0a56e3bc0fe0ad6d9bdc1286 (patch)
treef12b988b561fca7978cb83a463e6fcfa53ae0499
parentef41303f8529f8fffb307c3cf3f2ccda1697caaf (diff)
downloadpython-termcast-server-f144cdf8adcb233a0a56e3bc0fe0ad6d9bdc1286.tar.gz
python-termcast-server-f144cdf8adcb233a0a56e3bc0fe0ad6d9bdc1286.zip
q should return to the watching menu
-rw-r--r--ssh.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/ssh.py b/ssh.py
index 809bb2d..44f24f9 100644
--- a/ssh.py
+++ b/ssh.py
@@ -13,14 +13,20 @@ class Connection(object):
self.transport.start_server(server=Server())
self.chan = self.transport.accept(None)
- self.watching_id = self.select_stream()
-
- self.publisher.notify("new_viewer", self.watching_id)
-
while True:
- c = self.chan.recv(1)
- if c == b'q':
+ self.initialized = False
+
+ self.watching_id = self.select_stream()
+ if self.watching_id is None:
break
+
+ self.publisher.notify("new_viewer", self.watching_id)
+
+ while True:
+ c = self.chan.recv(1)
+ if c == b'q':
+ break
+
self.chan.close()
def select_stream(self):
@@ -41,6 +47,8 @@ class Connection(object):
if c in keymap:
self.chan.send("\033[2J\033[H")
return keymap[c]
+ elif c == 'q':
+ return None
else:
return self.select_stream()