mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-04-07 02:26:28 +02:00
Debug turn off for wired communications
This commit is contained in:
parent
d0ae9f3296
commit
f4db71e833
1 changed files with 13 additions and 5 deletions
|
@ -204,11 +204,11 @@ class Simulator:
|
||||||
else:
|
else:
|
||||||
selector_wireless.append(False)
|
selector_wireless.append(False)
|
||||||
selector_wired.append(False)
|
selector_wired.append(False)
|
||||||
# Informed senders of wired events to cancel send
|
# Build the set of senders to notify (only in wired connections,
|
||||||
|
# indeed IRL, in wireless communications sender would send all its data)
|
||||||
|
senders_to_notify=set()
|
||||||
for event in self.events[selector_wired]:
|
for event in self.events[selector_wired]:
|
||||||
sender=self.nodes[int(event[2][0])]
|
senders_to_notify.add(int(event[2][0]))
|
||||||
sender["state"]="running"
|
|
||||||
sender.rqueue.put(("send_cancel",2))
|
|
||||||
# Remove communications from the event list
|
# Remove communications from the event list
|
||||||
if(len(self.events) != 0):
|
if(len(self.events) != 0):
|
||||||
self.events=self.events[~(np.array(selector_wireless)|np.array(selector_wired))]
|
self.events=self.events[~(np.array(selector_wireless)|np.array(selector_wired))]
|
||||||
|
@ -219,6 +219,14 @@ class Simulator:
|
||||||
node["state"]="running"
|
node["state"]="running"
|
||||||
node.rqueue.put(("turn_off",0))
|
node.rqueue.put(("turn_off",0))
|
||||||
self.log("Turned off",node=node.node_id)
|
self.log("Turned off",node=node.node_id)
|
||||||
|
# Informed senders of wired events that communication ended
|
||||||
|
for sender_id in senders_to_notify:
|
||||||
|
sender_node=self.nodes[sender_id]
|
||||||
|
sender_node["state"]="running"
|
||||||
|
sender_node.rqueue.put(("send_cancel",2))
|
||||||
|
# The node should resume at current self.time. So, sync the sender now:
|
||||||
|
self.sync_node_non_blocking(sender_node)
|
||||||
|
self.sync_node_blocking(sender_node)
|
||||||
elif node["request"] == "send_cancel":
|
elif node["request"] == "send_cancel":
|
||||||
selector=list()
|
selector=list()
|
||||||
for event in self.events:
|
for event in self.events:
|
||||||
|
@ -436,7 +444,7 @@ class Simulator:
|
||||||
src["state"]="running"
|
src["state"]="running"
|
||||||
src.rqueue.put(("send",0))
|
src.rqueue.put(("send",0))
|
||||||
self.sync_node_non_blocking(src,timeout_remove_only=True)
|
self.sync_node_non_blocking(src,timeout_remove_only=True)
|
||||||
elif event_type == 1:
|
elif event_type == 1: # Timeout
|
||||||
node=self.nodes[int(event)]
|
node=self.nodes[int(event)]
|
||||||
node["state"]="running"
|
node["state"]="running"
|
||||||
node.rqueue.put(("timeout",0))
|
node.rqueue.put(("timeout",0))
|
||||||
|
|
Loading…
Add table
Reference in a new issue