From 492b90f1923b855ab3b5ed1f31da0a78661590e0 Mon Sep 17 00:00:00 2001 From: "Jay B. Martin" Date: Tue, 27 May 2014 02:20:00 -0400 Subject: [PATCH] Tear down tunnel on server off and server restart --- psiturk/psiturk_shell.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/psiturk/psiturk_shell.py b/psiturk/psiturk_shell.py index f36a8137a..6c051cb3d 100644 --- a/psiturk/psiturk_shell.py +++ b/psiturk/psiturk_shell.py @@ -362,6 +362,7 @@ def do_server(self, arg): Usage: server on server off + server restart server log server help """ @@ -468,6 +469,18 @@ def do_quit(self, arg): return return True + def server_off(self): + self.server.shutdown() + print 'Please wait. This could take a few seconds.' + self.clean_up() + while self.server.is_server_running() != 'no': + time.sleep(0.5) + + def server_restart(self): + self.server_off() + self.clean_up() + self.server_on() + def clean_up(self): if self.tunnel.is_open: print 'Closing tunnel...'