# Code design

Todo

- Link to refactor proposal.

- Change this page when refactoring is implemented.

## UML classes diagram

classes_original.svg

## Packages diagram

packages_sbws.svg

## scanner threads

- TorEventListener: the thread that runs Tor and listens for events.

- ResultDump: the thread that get the measurement results from a queue every second.

- multiprocessing.ThreadPool starts 3 independent threads: - workers_thread - tasks_thread - results_thread

- measurement threads: they execute `sbws.core.scanner.measure_relay()` There’ll be a maximum of 3 by default.

## Critical sections

Data types that are read or wrote from the threads.

## Call graph

Initialization calls to the moment where the measurement threads start.

callgraph.png