summaryrefslogtreecommitdiff
path: root/esds/node.py
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-08-31 11:25:48 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2022-08-31 11:25:48 +0200
commitc63ae59a81c8ace0c243bfa2ab265eff61ea6cfe (patch)
treeb9e53731c869fdd07625ab2c87cd00444db4a99e /esds/node.py
parent5384940ca79bc49b2240a10337aa1c6f6031efa3 (diff)
Add manual and improve node plugins system
Diffstat (limited to 'esds/node.py')
-rw-r--r--esds/node.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/esds/node.py b/esds/node.py
index 6a2566d..59b6f96 100644
--- a/esds/node.py
+++ b/esds/node.py
@@ -13,7 +13,7 @@ class Node:
self.rargs=None # Store the requests arguments
self.plugins=list() # Contains all registered node plugins
self.rqueue=queue.Queue() # Receive simulator acknowledgments
- self.chest={"state":"running", "turned_on":True, "request": None, "interfaces":dict(), "interfaces_queue_size":dict()}
+ self.chest={"state":"running", "turned_on":True, "request": None, "interfaces":dict(), "interfaces_queue_size":dict(), "plugin_notify": dict()}
for interface in interfaces:
self.chest["interfaces"][interface]=queue.Queue()
self.chest["interfaces_queue_size"][interface]=0
@@ -22,6 +22,11 @@ class Node:
def plugin_register(self,plugin):
self.plugins.append(plugin)
+ def plugin_handle_requests(self):
+ # Take plugins notification into account
+ for key in list(self["plugin_notify"]):
+ self.plugin_notify(key,self["plugin_notify"].pop(key))
+
def plugin_notify(self,reason,args):
"""
This function strives to avoid using Python specific features
@@ -33,6 +38,8 @@ class Node:
p.on_send_call(args[0],args[1],args[2],args[3])
if reason == "send_return":
p.on_send_return(args[0],args[1],args[2],args[3],args[4])
+ if reason == "on_communication_end":
+ p.on_communication_end(args[0],args[1],args[2],args[3],args[4])
if reason == "terminated":
p.on_terminated()