diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-06-28 11:40:57 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-06-28 11:40:57 +0200 |
| commit | 838e48438cf6597a172ea2af8749b68445bc30c6 (patch) | |
| tree | 9c8640afe3fcec8ace6e16168ced09b3325ba19c /esds/simulator.py | |
| parent | 535eb79ad7d781915a6999313683113602369989 (diff) | |
Refactoring
Diffstat (limited to 'esds/simulator.py')
| -rw-r--r-- | esds/simulator.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/esds/simulator.py b/esds/simulator.py index a9866b8..b65e5cf 100644 --- a/esds/simulator.py +++ b/esds/simulator.py @@ -128,7 +128,7 @@ class Simulator: Process all call request and wait for Node.sync() to return """ node.sync() - while node["state"] == "call": + while node["state"] == "call_non_blocking": if node["request"] == "log": self.log(node.rargs,node=node.node_id) node["state"]="running" @@ -267,7 +267,7 @@ class Simulator: """ Collect events from the nodes """ - if node["state"] == "request": + if node["state"] == "call_blocking": if node["request"] == "send": node["state"]="pending" interface, data, datasize, dst=node.rargs @@ -303,7 +303,7 @@ class Simulator: 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)) else: - nsrc["state"]="request" # Try later when node is on + nsrc["state"]="call_blocking" # Try later when node is on else: self.log("Send "+str(datasize)+" bytes on "+interface,node=src) for dst in self.list_receivers(nsrc,interface): @@ -392,7 +392,7 @@ class Simulator: 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"] == "request" and dst["request"] == "receive": + if dst["state"] == "call_blocking" and dst["request"] == "receive": dst["interfaces_queue_size"][interface]-=1 dst["state"]="running" dst.rqueue.put(("receive",0)) @@ -405,7 +405,7 @@ class Simulator: dst["interfaces_queue_size"][interface]+=1 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"] == "request" and dst["request"] == "receive": + if dst["state"] == "call_blocking" and dst["request"] == "receive": dst["interfaces_queue_size"][interface]-=1 dst["state"]="running" dst.rqueue.put(("receive",0)) |
