Skip to content

Commit

Permalink
Merge pull request XX-net#6 from XX-net/master
Browse files Browse the repository at this point in the history
sync from original repo
  • Loading branch information
aOJzQT committed Sep 20, 2015
2 parents 71a2521 + 038533e commit 9bddb97
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions launcher/web_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ def req_init_module_handler(self):
server = 0
def start():
global process, server
server = LocalServer(("0.0.0.0", 8085), Http_Handler)
# should use config.yaml to bing ip
server = LocalServer(("127.0.0.1", 8085), Http_Handler)
process = threading.Thread(target=server.serve_forever)
process.setDaemon(True)
process.start()
Expand Down Expand Up @@ -415,17 +416,27 @@ def http_request(url, method="GET"):
return False

def confirm_xxnet_exit():
# suppose xxnet is running, try to close it
is_xxnet_exit = False
launcher_log.debug("start confirm_xxnet_exit")
for i in range(30):
if http_request("http://127.0.0.1:8087/quit") == False:
return True
launcher_log.debug("good, xxnet:8087 cleared!")
is_xxnet_exit = True
break
else:
launcher_log.debug("<%d>: try to terminate xxnet:8087" % i)
time.sleep(1)
for i in range(30):
if http_request("http://127.0.0.1:8085/quit") == False:
return True
launcher_log.debug("good, xxnet:8085 clear!")
is_xxnet_exit = True
break
else:
launcher_log.debug("<%d>: try to terminate xxnet:8085" % i)
time.sleep(1)
launcher_log.debug("finished confirm_xxnet_exit")
return False
return is_xxnet_exit

def confirm_module_ready(port):
if port == 0:
Expand Down

0 comments on commit 9bddb97

Please sign in to comment.