Skip to content

Commit

Permalink
Tear down tunnel on server off and server restart
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmartin committed May 27, 2014
1 parent c106450 commit 492b90f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions psiturk/psiturk_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ def do_server(self, arg):
Usage:
server on
server off
server restart
server log
server help
"""
Expand Down Expand Up @@ -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...'
Expand Down

0 comments on commit 492b90f

Please sign in to comment.