From 3c4aa53894d27fd252885f106b78b6cac1aacfc7 Mon Sep 17 00:00:00 2001 From: Ronald Steinke Date: Tue, 13 Feb 2018 09:33:55 +0100 Subject: [PATCH] stops transport plugins in the end --- openmtc-gevent/src/openmtc_gevent/main.py | 4 +++- server/openmtc-server/src/openmtc_server/Plugin.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openmtc-gevent/src/openmtc_gevent/main.py b/openmtc-gevent/src/openmtc_gevent/main.py index c5cce00..619323d 100644 --- a/openmtc-gevent/src/openmtc_gevent/main.py +++ b/openmtc-gevent/src/openmtc_gevent/main.py @@ -178,7 +178,9 @@ def stop_plugin(plugin): def stop_plugins(): - map(stop_plugin, _plugins) + # stop transport plugins after the others + map(stop_plugin, filter(lambda p: not p.name.endswith('TransportPlugin'), _plugins)) + map(stop_plugin, filter(lambda p: p.name.endswith('TransportPlugin'), _plugins)) def init_component(component, api): diff --git a/server/openmtc-server/src/openmtc_server/Plugin.py b/server/openmtc-server/src/openmtc_server/Plugin.py index 0573ac8..f6d6dac 100644 --- a/server/openmtc-server/src/openmtc_server/Plugin.py +++ b/server/openmtc-server/src/openmtc_server/Plugin.py @@ -97,6 +97,7 @@ class Plugin(BasicPlugin): self.api = api self.events = api.events + self.name = self.__class__.__name__ def get_shelve(self, name): return self.api.db.get_shelve("%s_%s" % (type(self).__name__, name))