diff options
author | WuKong <rebirthmonkey@gmail.com> | 2017-07-19 14:01:30 +0200 |
---|---|---|
committer | WuKong <rebirthmonkey@gmail.com> | 2017-07-19 14:01:30 +0200 |
commit | 6a59009e64f727bcf3c67a8ae45a02e4137bfb99 (patch) | |
tree | d58fed674114f4ee8497efec8d303d0f4baba836 /moonv4/moon_router/moon_secrouter/server.py | |
parent | ffd694ebadb1d3b4e140104f9f0a81837c0e7258 (diff) |
update moon_router
Change-Id: Iafa79fce14d965dba2f21612eb9c2ae47599c6d7
Signed-off-by: WuKong <rebirthmonkey@gmail.com>
Diffstat (limited to 'moonv4/moon_router/moon_secrouter/server.py')
-rw-r--r-- | moonv4/moon_router/moon_secrouter/server.py | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/moonv4/moon_router/moon_secrouter/server.py b/moonv4/moon_router/moon_secrouter/server.py deleted file mode 100644 index 16f6ea9c..00000000 --- a/moonv4/moon_router/moon_secrouter/server.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors -# This software is distributed under the terms and conditions of the 'Apache-2.0' -# license which can be found in the file 'LICENSE' in this package distribution -# or at 'http://www.apache.org/licenses/LICENSE-2.0'. - -import os -import threading -import signal -from oslo_config import cfg -from oslo_log import log as logging -from moon_utilities import options # noqa -from moon_secrouter.messenger import Server - - -class AsyncServer(threading.Thread): - - def __init__(self, add_master_cnx): - threading.Thread.__init__(self) - self.server = Server(add_master_cnx=add_master_cnx) - - def run(self): - self.server.run() - -LOG = logging.getLogger(__name__) -CONF = cfg.CONF -DOMAIN = "moon_secrouter" - -__CWD__ = os.path.dirname(os.path.abspath(__file__)) - -background_threads = [] - - -def stop_thread(): - for _t in background_threads: - _t.stop() - - -def main(): - global background_threads - LOG.info("Starting server with IP {}".format(CONF.security_router.host)) - signal.signal(signal.SIGALRM, stop_thread) - signal.signal(signal.SIGTERM, stop_thread) - signal.signal(signal.SIGABRT, stop_thread) - background_master = None - if CONF.slave.slave_name: - background_master = AsyncServer(add_master_cnx=True) - background_threads.append(background_master) - background_slave = AsyncServer(add_master_cnx=False) - background_threads.append(background_slave) - if CONF.slave.slave_name: - background_master.start() - background_slave.start() - if CONF.slave.slave_name: - background_master.join() - background_slave.join() - - -if __name__ == '__main__': - main() |