diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-07-01 18:12:28 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-07-01 18:12:28 +0200 |
| commit | 18c705a11efec6c67e07981ae0f55727cbd47f4d (patch) | |
| tree | bb55d756d30011c90080be124ba89ffac0fc8b19 /esds | |
| parent | 33ffa0b6e0af5e2f658d9d12d0347ea57edc97a7 (diff) | |
Debug wired communications when receiver is off.
Diffstat (limited to 'esds')
| -rw-r--r-- | esds/simulator.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/esds/simulator.py b/esds/simulator.py index 74f126e..fc76daf 100644 --- a/esds/simulator.py +++ b/esds/simulator.py @@ -306,14 +306,11 @@ class Simulator: """ nsrc=self.nodes[src] if self.netmat[interface]["is_wired"]: - if self.nodes[dst]["turned_on"]: - self.log("Send "+str(datasize)+" bytes to n"+str(dst)+" on "+interface,node=src) - self.update_sharing(dst,1,interface) # Update sharing first - # Note that in the following we send more data than expected to handle bandwidth sharing (datasize*8*sharing): - duration=datasize*8/(self.netmat[interface]["bandwidth"][src,dst]/self.sharing[interface][dst])+self.netmat[interface]["latency"][src,dst] - self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time,True)) - else: - nsrc["state"]="call_blocking" # Try later when node is on + self.log("Send "+str(datasize)+" bytes to n"+str(dst)+" on "+interface,node=src) + self.update_sharing(dst,1,interface) # Update sharing first + # Note that in the following we send more data than expected to handle bandwidth sharing (datasize*8*sharing): + duration=datasize*8/(self.netmat[interface]["bandwidth"][src,dst]/self.sharing[interface][dst])+self.netmat[interface]["latency"][src,dst] + self.add_event(0,duration+self.time,(src,dst,interface,data,datasize,duration,datasize,self.time,self.nodes[dst]["turned_on"])) else: self.log("Send "+str(datasize)+" bytes on "+interface,node=src) for dst in self.list_receivers(nsrc,interface): @@ -400,7 +397,6 @@ class Simulator: if perform_delivery: dst["interfaces"][interface].put((data,start_at,self.time)) dst["interfaces_queue_size"][interface]+=1 - self.update_sharing(dst.node_id,-1,interface) self.log("Receive "+str(datasize)+" bytes on "+interface,node=int(dst_id)) # If node is receiving makes it consume (this way if there is a timeout, it will be removed!) if dst["state"] == "call_blocking" and dst["request"] == "receive": @@ -408,6 +404,7 @@ class Simulator: dst["state"]="running" dst.rqueue.put(("receive",0)) self.sync_node_non_blocking(dst,timeout_remove_only=True) + self.update_sharing(dst.node_id,-1,interface) src["state"]="running" src.rqueue.put(("send",0)) self.sync_node_non_blocking(src,timeout_remove_only=True) |
