Skip to content

Commit

Permalink
Merge branch 'master' of github.com:eclipse/paho.mqtt.testing
Browse files Browse the repository at this point in the history
  • Loading branch information
icraggs committed Apr 13, 2023
2 parents 073555a + 252b6b9 commit 577f955
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions interoperability/mqtt/brokers/start.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
*******************************************************************
Copyright (c) 2013, 2019 IBM Corp.
Copyright (c) 2013, 2021 IBM Corp. and Ian Craggs
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -18,7 +18,7 @@
*******************************************************************
"""

import sys, traceback, logging, getopt, threading, ssl
import sys, traceback, logging, getopt, threading, ssl, signal

from .V311 import MQTTBrokers as MQTTV3Brokers
from .V5 import MQTTBrokers as MQTTV5Brokers
Expand All @@ -32,6 +32,10 @@

logger = None

def handler(signum, frame):
logger.info('Signal handler called with signal %d', signum)
raise OSError("Signal interrupt")

def setup_persistence(persistence_filename):
import ZODB, ZODB.FileStorage, BTrees.OOBTree, transaction, persistent
storage = ZODB.FileStorage.FileStorage(persistence_filename)
Expand Down Expand Up @@ -134,6 +138,8 @@ def run(config=None):

logger.info("Python version "+sys.version)

signal.signal(signal.SIGTERM, handler)

lock = threading.RLock() # shared lock

options = {
Expand Down Expand Up @@ -192,7 +198,7 @@ def run(config=None):
else:
for server in servers_to_create:
servers.append(server[0].create(**server[1]))
except KeyboardInterrupt:
except (KeyboardInterrupt, OSError):
pass
except:
logger.exception("startBroker")
Expand Down

0 comments on commit 577f955

Please sign in to comment.