From 04a8303ca9498c7d11440e809fc9cfdf43cc1a45 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 25 Oct 2019 13:30:07 +0200 Subject: [PATCH] set route statistics callback --- boswatch/router/router.py | 2 +- boswatch/router/routerManager.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boswatch/router/router.py b/boswatch/router/router.py index 496cf38..d88def1 100644 --- a/boswatch/router/router.py +++ b/boswatch/router/router.py @@ -47,7 +47,7 @@ class Router: logging.debug("[%s] started", self._name) for routeObject in self._routeList: logging.debug("[%s] -> run route: %s", self._name, routeObject.name) - bwPacket_tmp = routeObject.callback._run(copy.deepcopy(bwPacket)) # copy bwPacket to prevent edit the original + bwPacket_tmp = routeObject.callback(copy.deepcopy(bwPacket)) # copy bwPacket to prevent edit the original if bwPacket_tmp is None: # returning None doesnt change the bwPacket continue diff --git a/boswatch/router/routerManager.py b/boswatch/router/routerManager.py index 2613238..a057872 100644 --- a/boswatch/router/routerManager.py +++ b/boswatch/router/routerManager.py @@ -77,12 +77,12 @@ class RouterManager: if routeType == "plugin": importedFile = importlib.import_module(routeType + "." + routeRes) loadedClass = importedFile.BoswatchPlugin(routeConfig) - routerDict_tmp[routerName].addRoute(Route(routeName, loadedClass)) + routerDict_tmp[routerName].addRoute(Route(routeName, loadedClass._run, loadedClass._getStatistics)) elif routeType == "module": importedFile = importlib.import_module(routeType + "." + routeRes) loadedClass = importedFile.BoswatchModule(routeConfig) - routerDict_tmp[routerName].addRoute(Route(routeName, loadedClass)) + routerDict_tmp[routerName].addRoute(Route(routeName, loadedClass._run, loadedClass._getStatistics)) elif routeType == "router": routerDict_tmp[routerName].addRoute(Route(routeName, routerDict_tmp[routeName].runRouter))