|
@@ -313,38 +313,6 @@ if __name__ == '__main__':
|
|
#
|
|
#
|
|
for stream_index in range(args.num_streams_per_client):
|
|
for stream_index in range(args.num_streams_per_client):
|
|
for (controller_index, proxy_address, controller) in zip(range(len(controllers)), proxy_addresses, controllers):
|
|
for (controller_index, proxy_address, controller) in zip(range(len(controllers)), proxy_addresses, controllers):
|
|
- '''
|
|
|
|
- client_socket = socket.socket()
|
|
|
|
- #
|
|
|
|
- logging.debug('Socket %d connecting to proxy %r...', client_socket.fileno(), proxy_address['socks'])
|
|
|
|
- client_socket.connect(proxy_address['socks'])
|
|
|
|
- logging.debug('Socket %d connected', client_socket.fileno())
|
|
|
|
- #
|
|
|
|
- wait_offset = random.randint(0, args.wait_range)
|
|
|
|
- custom_data = {}
|
|
|
|
- #
|
|
|
|
- circuit_id = controller.assign_stream(client_socket.getsockname())
|
|
|
|
- custom_data['circuit'] = (circuit_id, controller.circuits[circuit_id])
|
|
|
|
- #
|
|
|
|
- if args.measureme:
|
|
|
|
- measureme_id = stream_index*args.num_streams_per_client + controllers.index(controller) + 1
|
|
|
|
- custom_data['measureme_id'] = measureme_id
|
|
|
|
- #
|
|
|
|
- hops = list(range(len(controller.circuits[circuit_id])+1))[::-1]
|
|
|
|
- # send the measureme cells to the last relay first
|
|
|
|
- start_cb = lambda control_address=proxy_address['control'], circuit_id=circuit_id, measureme_id=measureme_id, \
|
|
|
|
- hops=hops, event=start_event, wait_offset=wait_offset: \
|
|
|
|
- send_measureme_cells_and_wait(control_address, circuit_id, measureme_id, hops, event, wait_offset)
|
|
|
|
- else:
|
|
|
|
- start_cb = lambda event=start_event, duration=wait_offset: wait_then_sleep(event, duration)
|
|
|
|
- #
|
|
|
|
- custom_data = json.dumps(custom_data).encode('utf-8')
|
|
|
|
- protocol = ExperimentProtocol(client_socket, endpoint, args.num_bytes,
|
|
|
|
- custom_data=custom_data,
|
|
|
|
- send_buffer_len=args.buffer_len,
|
|
|
|
- push_start_cb=start_cb)
|
|
|
|
- #
|
|
|
|
- '''
|
|
|
|
if args.measureme:
|
|
if args.measureme:
|
|
measureme_id = stream_index*args.num_streams_per_client + controller_index + 1
|
|
measureme_id = stream_index*args.num_streams_per_client + controller_index + 1
|
|
else:
|
|
else:
|