Commit cdc3f8a6 authored by thomas alfroy's avatar thomas alfroy
Browse files

fix issues

parent 500bbf97
......@@ -116,7 +116,7 @@ hybride = False
options, remainder = getopt.getopt(sys.argv[1:], 'dvsehl:', ['debug', 'verbose', 'second=', 'ecn', 'help', 'limit=',])
options, remainder = getopt.getopt(sys.argv[1:], 'dvs:ehl:', ['debug', 'verbose', 'second=', 'ecn', 'help', 'limit=',])
for opt, arg in options:
if opt in ('-d', '--debug'):
......@@ -159,8 +159,8 @@ while con:
if act_time + second <= time.time():
if second != 0.0 :
print("{} packets received last second".format(nb_packets))
nb_packets = 0
act_time = time.time()
nb_packets = 0
act_time = time.time()
tagged = False
i_ready, o_ready, e_ready = select.select(input, [], [], second)
......@@ -171,16 +171,15 @@ while con:
nb_packets += 1
if nb_packets > MAX_PACKETS:
if ecn :
if not tagged:
data_tmp = bytearray(data)
data_tmp[6] = ECN_ACTIVE
data = bytes(data_tmp)
tagged = True
if random.random() <= 0.7:
if ecn :
if not tagged:
data_tmp = bytearray(data)
data_tmp[6] = ECN_ACTIVE
data = bytes(data_tmp)
tagged = True
sock_recv.sendto(data, (dest_recv, port_recv))
else:
if random.random() <= 0.7:
sock_recv.sendto(data, (dest_recv, port_recv))
else:
sock_recv.sendto(data, (dest_recv, port_recv))
......
File added
File added
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