From ad541c67761b8aa6da1566802c347cac4018d0c2 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 2 Nov 2026 20:50:24 +0100 Subject: Move the build sources into src/ --- src/ot_clean.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/ot_clean.h (limited to 'src/ot_clean.h') diff --git a/src/ot_clean.h b/src/ot_clean.h new file mode 100644 index 0000000..0592791 --- /dev/null +++ b/src/ot_clean.h @@ -0,0 +1,28 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. */ + +#ifndef OT_CLEAN_H__ +#define OT_CLEAN_H__ + +#include "trackerlogic.h" + +/* The amount of time a clean cycle should take */ +#define OT_CLEAN_INTERVAL_MINUTES 2 + +/* How often the cleaner may wake. A full sweep takes OT_CLEAN_INTERVAL_MINUTES. + The clean operations per wake is goverend by OT_BUCKET_COUNT_BITS, + set by the Makefile. + At the default of 1024 buckets this works out at one bucket every + 117 ms. */ +#define OT_CLEAN_MAX_WAKES_PER_SECOND 10 + +#define OT_CLEAN_WAKE_BUDGET ((OT_CLEAN_INTERVAL_MINUTES) * 60 * (OT_CLEAN_MAX_WAKES_PER_SECOND)) +#define OT_CLEAN_BUCKETS_PER_WAKE (((OT_BUCKET_COUNT) + (OT_CLEAN_WAKE_BUDGET) - 1) / (OT_CLEAN_WAKE_BUDGET)) +#define OT_CLEAN_WAKES ((OT_BUCKET_COUNT) / (OT_CLEAN_BUCKETS_PER_WAKE)) +#define OT_CLEAN_SLEEP (((OT_CLEAN_INTERVAL_MINUTES) * 60 * 1000000) / (OT_CLEAN_WAKES)) + +void clean_init(void); +void clean_deinit(void); +int clean_single_torrent(ot_torrent *torrent); + +#endif -- cgit v1.3