Commit 8bdf973d authored by thomas alfroy's avatar thomas alfroy
Browse files

fix ecn bug

parent 49199451
......@@ -154,23 +154,27 @@ con = True
act_time = time.time()
nb_packets = 0
tagged = False
nb_packets_per_sec = 0
while con:
# Reload the number of packet per seconds (for generated failures)
if act_time + 1.0 <= time.time():
nb_packets_per_sec = 0
# Each tick stamp, print the number of received packets
if act_time + second <= time.time():
if second != 0.0 :
print("{} packets received last second".format(nb_packets))
if ecn != 0.0:
if act_time + ecn <= time.time():
nb_packets = 0
act_time = time.time()
tagged = False
else:
if act_time + 1.0 <= time.time():
nb_packets = 0
act_time = time.time()
tagged = False
if act_time + second <= time.time():
nb_packets = 0
act_time = time.time()
i_ready, o_ready, e_ready = select.select(input, [], [], second)
......@@ -179,7 +183,7 @@ while con:
data, addr = sock_sender.recvfrom(64)
nb_packets += 1
if nb_packets > MAX_PACKETS:
if nb_packets_per_sec > MAX_PACKETS:
if random.random() <= 0.7:
if ecn != 0.0 :
if not tagged:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment