Skip to content

Commit

Permalink
bugfix : The delay on ack does not change and some optimizations in m…
Browse files Browse the repository at this point in the history
…emory
  • Loading branch information
Azson committed Jul 23, 2020
1 parent 817e443 commit 921d53c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion objects/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def create_new_links_and_senders(self):
# bw = self.trace_list[0][1]

queue = int(random.uniform(*self.queue_range))
self.links = [Link(self.trace_list, queue) , Link([], queue)]
self.links = [Link(self.trace_list, queue) , Link([], queue, delay=self.trace_list[0][3])]
#self.senders = [Sender(0.3 * bw, [self.links[0], self.links[1]], 0, self.history_len)]
#self.senders = [Sender(random.uniform(0.2, 0.7) * bw, [self.links[0], self.links[1]], 0, self.history_len)]
solution = Aitrans_solution() if not self.solution else self.solution
Expand Down
3 changes: 3 additions & 0 deletions objects/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ def append_cc_input(self, event_time, sender, packet, event_type="packet"):
}

feed_back = sender.solution.append_input(data)
# clear memory from solution._input_list
if hasattr(sender.solution, "_input_list") and len(sender.solution._input_list) > 10000:
sender.solution._input_list = sender.solution._input_list[5000:]
if feed_back:
sender.cwnd = feed_back["cwnd"] if "cwnd" in feed_back else sender.cwnd
sender.rate = feed_back["send_rate"] if "send_rate" in feed_back else sender.rate
Expand Down
8 changes: 4 additions & 4 deletions objects/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

class Link():

def __init__(self, trace_list, queue_size):
def __init__(self, trace_list, queue_size, **kwargs):
"""
:param trace_list: [[time, bandwith, loss_rate, delay] ...]
:param queue_size:
"""
self.id = Link._get_next_id()
self.trace_list = trace_list
if len(trace_list) == 0:
self.bandwith = np.inf
self.loss_rate = .0
self.delay = .001
self.bandwith = np.inf if "bandwith" not in kwargs else kwargs["bandwith"]
self.loss_rate = .0 if "loss_rate" not in kwargs else kwargs["loss_rate"]
self.delay = .001 if "delay" not in kwargs else kwargs["delay"]
else:
self.bandwith = trace_list[0][1] * 10**6 / BYTES_PER_PACKET
self.loss_rate = trace_list[0][2]
Expand Down

0 comments on commit 921d53c

Please sign in to comment.