diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-08-15 11:30:17 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-08-15 11:30:17 +0200 |
| commit | 371749159b917dbb4d792517ac32fe6bb99e8bae (patch) | |
| tree | 93a755de68057d77940c6c6eb815bfc75b70c5d9 /esds | |
| parent | e0dbebe31d4288f3636ef3871f45429b86b1d737 (diff) | |
Debug send_cancel
Diffstat (limited to 'esds')
| -rw-r--r-- | esds/simulator.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/esds/simulator.py b/esds/simulator.py index 1678ecc..f2358fc 100644 --- a/esds/simulator.py +++ b/esds/simulator.py @@ -9,9 +9,9 @@ class Simulator: Event types: - 0 send (0,timestamp,(src,dst,interface,data,datasize,duration,datasize_remaining,start_timestamp, perform_delivery, receiver_required), 2) - 1 timeout (1,timestamp,node_id,3) - - 2 breakpoint_manual (3,timestamp,0,1) - - 3 breakpoint_auto (4,timestamp,0,1) - - 4 notify (5,timestamp,node_id,0) + - 2 breakpoint_manual (2,timestamp,0,1) + - 3 breakpoint_auto (3,timestamp,0,1) + - 4 notify (4,timestamp,node_id,0) Very important notes: @@ -231,14 +231,18 @@ class Simulator: self.sync_node_blocking(sender_node) elif node["request"] == "send_cancel": selector=list() + sharing_to_update=list() for event in self.events: if event[0]==0 and int(event[2][0]) == node.node_id: selector.append(True) if self.netmat[event[2][2]]["is_wired"]: - self.update_sharing(int(event[2][1]),-1,event[2][2]) + sharing_to_update.append((int(event[2][1]),event[2][2])) else: selector.append(False) self.events=self.events[~np.array(selector)] + # Now Update receiver of cancel communication sharing (since update_sharing sort event, selector would have been invalidated if done before) + for com in sharing_to_update: + self.update_sharing(com[0],-1,com[1]) node["state"]="running" node.rqueue.put(("send_cancel",0)) node.sync() @@ -246,6 +250,7 @@ class Simulator: def update_sharing(self, dst, amount,interface): """ Manage bandwidth sharing on wired interfaces + THIS FUNCTION SORT EVENTS SO BE CAREFUL SINCE IT CAN INVALIDATE SELECTORS """ sharing=self.sharing[interface][dst] new_sharing=sharing+amount |
