Skip to content

Commit

Permalink
Rev668, Stop if UiServer bind failed to avoid double start
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Dec 27, 2015
1 parent 35b0019 commit c9578e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Config(object):

def __init__(self, argv):
self.version = "0.3.4"
self.rev = 667
self.rev = 668
self.argv = argv
self.action = None
self.createParser()
Expand Down
7 changes: 6 additions & 1 deletion src/Ui/UiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import time
import cgi
import socket
import sys

from gevent.pywsgi import WSGIServer
from gevent.pywsgi import WSGIHandler
Expand Down Expand Up @@ -119,7 +120,11 @@ def start(self):

self.server = WSGIServer((self.ip.replace("*", ""), self.port), handler, handler_class=UiWSGIHandler, log=self.log)
self.server.sockets = {}
self.server.serve_forever()
try:
self.server.serve_forever()
except Exception, err:
self.log.error("Web interface bind error, must be running already, exiting.... %s" % err)
sys.modules["main"].file_server.stop()
self.log.debug("Stopped.")

def stop(self):
Expand Down

0 comments on commit c9578e9

Please sign in to comment.