diff options
Diffstat (limited to 'esds/simulator.py')
| -rw-r--r-- | esds/simulator.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/esds/simulator.py b/esds/simulator.py index 39e374c..aa6573b 100644 --- a/esds/simulator.py +++ b/esds/simulator.py @@ -188,23 +188,21 @@ class Simulator: self.log("Turned on",node=node.node_id) elif node["request"] == "turn_off": # Create communications selectors (True/False arrays) - selector_wireless=list() # Select all wireless events where node is involved - selector_wired=list() # Select all wired events where node is involved + selector_wireless=list() # Select all wireless events where node is receiver + selector_wired=list() # Select all wired events where node is receiver for event in self.events: if event[0]==0 and int(event[2][1])==node.node_id: if self.netmat[event[2][2]]["is_wired"]: selector_wireless.append(False) if event[2][9]: # Check if should be cancel on turn_off (receiver_required) selector_wired.append(True) - self.nodes[int(event[2][1])].rqueue.put(("plugin_notify","on_communication_end",("eth0",0,0,0,0))) else: selector_wired.append(False) event[2][8]=False # So set delivery to False!! - # TODO: notify receiver plugins else: selector_wireless.append(True) - # TODO: notify receiver plugins selector_wired.append(False) + self.notify_node_plugins(self.nodes[int(event[2][1])], "on_communication_end", (self.time,event)) else: selector_wireless.append(False) selector_wired.append(False) @@ -237,7 +235,7 @@ class Simulator: selector.append(True) if self.netmat[event[2][2]]["is_wired"]: sharing_to_update.append((int(event[2][1]),event[2][2])) - # TODO: notify sender plugins + self.notify_node_plugins(node, "on_communication_end", (self.time,event)) else: selector.append(False) self.events=self.events[~np.array(selector)] @@ -440,13 +438,13 @@ class Simulator: dst["state"]="running" dst.rqueue.put(("receive",0)) self.sync_node_non_blocking(dst,timeout_remove_only=True) - # TODO: notify receiver plugins + self.notify_node_plugins(dst, "on_communication_end", (self.time,event)) self.update_sharing(dst.node_id,-1,interface) src["state"]="running" code=0 if perform_delivery else 1 src.rqueue.put(("send",code)) self.sync_node_non_blocking(src,timeout_remove_only=True) - # TODO: notify sender plugins + self.notify_node_plugins(src, "on_communication_end", (self.time,event)) else: if src.node_id != dst.node_id: if perform_delivery: @@ -459,12 +457,12 @@ class Simulator: dst["state"]="running" dst.rqueue.put(("receive",0)) self.sync_node_non_blocking(dst,timeout_remove_only=True) - # TODO: notify receiver plugins + self.notify_node_plugins(dst, "on_communication_end", (self.time,event)) else: src["state"]="running" src.rqueue.put(("send",0)) self.sync_node_non_blocking(src,timeout_remove_only=True) - # TODO: notify sender plugins + self.notify_node_plugins(src, "on_communication_end", (self.time,event)) elif event_type == 1: # Timeout node=self.nodes[int(event)] node["state"]="running" |
