diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-06-10 21:19:43 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-06-10 21:19:43 +0200 |
| commit | 3fef2bbf4ba898fc932d515b864f4d9351798ef9 (patch) | |
| tree | 743fb5d21933d2eb79ba311a754390178d62f681 /esds.py | |
| parent | 7540e8290d4b770b23d94da734b6ddf9e208c287 (diff) | |
Enable nodes to have multiple interfaces
Diffstat (limited to 'esds.py')
| -rw-r--r-- | esds.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -5,7 +5,7 @@ import threading,importlib,queue,sys,time class Node: available_node_id=0 - def __init__(self,src): + def __init__(self,src,interfaces): """ """ @@ -16,7 +16,10 @@ 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":{"wlan0":queue.Queue(), "eth0":queue.Queue()}, "interfaces_queue_size":{"wlan0":0,"eth0":0}} + self.chest={"state":"running", "turned_on":True, "request": None, "interfaces":dict(), "interfaces_queue_size":dict()} + for interface in interfaces: + self.chest["interfaces"][interface]=queue.Queue() + self.chest["interfaces_queue_size"][interface]=0 self.chest_lock=threading.Lock() # To access/modify self.chest def plugin_register(self,plugin): @@ -266,7 +269,7 @@ class Simulator: """ Create a node thread and run it """ - node=Node(src) + node=Node(src, self.netmat.keys()) self.nodes.append(node) thread=threading.Thread(target=node.run, daemon=False,args=[args]) thread.start() |
