summaryrefslogtreecommitdiff
path: root/ot_mutex.h
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2024-04-15 00:39:02 +0200
committerDirk Engling <erdgeist@erdgeist.org>2024-04-15 00:39:02 +0200
commit7c633c259ebc4a863c5076462c5792ecb8b9f617 (patch)
tree550a272a82325c554923c7498811cb8971aa49c2 /ot_mutex.h
parent4c5935c0574481dc4b0e0bf57528dc3069e34742 (diff)
clang-format
Diffstat (limited to 'ot_mutex.h')
-rw-r--r--ot_mutex.h115
1 files changed, 58 insertions, 57 deletions
diff --git a/ot_mutex.h b/ot_mutex.h
index 9eb17e5..66b627f 100644
--- a/ot_mutex.h
+++ b/ot_mutex.h
@@ -7,72 +7,73 @@
7#define OT_MUTEX_H__ 7#define OT_MUTEX_H__
8 8
9#include <sys/uio.h> 9#include <sys/uio.h>
10#include "trackerlogic.h"
10 11
11void mutex_init( void ); 12void mutex_init(void);
12void mutex_deinit( void ); 13void mutex_deinit(void);
13 14
14ot_vector *mutex_bucket_lock( int bucket ); 15ot_vector *mutex_bucket_lock(int bucket);
15ot_vector *mutex_bucket_lock_by_hash( ot_hash const hash ); 16ot_vector *mutex_bucket_lock_by_hash(ot_hash const hash);
16 17
17void mutex_bucket_unlock( int bucket, int delta_torrentcount ); 18void mutex_bucket_unlock(int bucket, int delta_torrentcount);
18void mutex_bucket_unlock_by_hash( ot_hash const hash, int delta_torrentcount ); 19void mutex_bucket_unlock_by_hash(ot_hash const hash, int delta_torrentcount);
19 20
20size_t mutex_get_torrent_count(void); 21size_t mutex_get_torrent_count(void);
21 22
22typedef enum { 23typedef enum {
23 TASK_STATS_CONNS = 0x0001, 24 TASK_STATS_CONNS = 0x0001,
24 TASK_STATS_TCP = 0x0002, 25 TASK_STATS_TCP = 0x0002,
25 TASK_STATS_UDP = 0x0003, 26 TASK_STATS_UDP = 0x0003,
26 TASK_STATS_SCRAPE = 0x0004, 27 TASK_STATS_SCRAPE = 0x0004,
27 TASK_STATS_FULLSCRAPE = 0x0005, 28 TASK_STATS_FULLSCRAPE = 0x0005,
28 TASK_STATS_TPB = 0x0006, 29 TASK_STATS_TPB = 0x0006,
29 TASK_STATS_HTTPERRORS = 0x0007, 30 TASK_STATS_HTTPERRORS = 0x0007,
30 TASK_STATS_VERSION = 0x0008, 31 TASK_STATS_VERSION = 0x0008,
31 TASK_STATS_BUSY_NETWORKS = 0x0009, 32 TASK_STATS_BUSY_NETWORKS = 0x0009,
32 TASK_STATS_RENEW = 0x000a, 33 TASK_STATS_RENEW = 0x000a,
33 TASK_STATS_SYNCS = 0x000b, 34 TASK_STATS_SYNCS = 0x000b,
34 TASK_STATS_COMPLETED = 0x000c, 35 TASK_STATS_COMPLETED = 0x000c,
35 TASK_STATS_NUMWANTS = 0x000d, 36 TASK_STATS_NUMWANTS = 0x000d,
36 37
37 TASK_STATS = 0x0100, /* Mask */ 38 TASK_STATS = 0x0100, /* Mask */
38 TASK_STATS_TORRENTS = 0x0101, 39 TASK_STATS_TORRENTS = 0x0101,
39 TASK_STATS_PEERS = 0x0102, 40 TASK_STATS_PEERS = 0x0102,
40 TASK_STATS_SLASH24S = 0x0103, 41 TASK_STATS_SLASH24S = 0x0103,
41 TASK_STATS_TOP10 = 0x0104, 42 TASK_STATS_TOP10 = 0x0104,
42 TASK_STATS_TOP100 = 0x0105, 43 TASK_STATS_TOP100 = 0x0105,
43 TASK_STATS_EVERYTHING = 0x0106, 44 TASK_STATS_EVERYTHING = 0x0106,
44 TASK_STATS_FULLLOG = 0x0107, 45 TASK_STATS_FULLLOG = 0x0107,
45 TASK_STATS_WOODPECKERS = 0x0108, 46 TASK_STATS_WOODPECKERS = 0x0108,
46 47
47 TASK_FULLSCRAPE = 0x0200, /* Default mode */ 48 TASK_FULLSCRAPE = 0x0200, /* Default mode */
48 TASK_FULLSCRAPE_TPB_BINARY = 0x0201, 49 TASK_FULLSCRAPE_TPB_BINARY = 0x0201,
49 TASK_FULLSCRAPE_TPB_ASCII = 0x0202, 50 TASK_FULLSCRAPE_TPB_ASCII = 0x0202,
50 TASK_FULLSCRAPE_TPB_ASCII_PLUS = 0x0203, 51 TASK_FULLSCRAPE_TPB_ASCII_PLUS = 0x0203,
51 TASK_FULLSCRAPE_TPB_URLENCODED = 0x0204, 52 TASK_FULLSCRAPE_TPB_URLENCODED = 0x0204,
52 TASK_FULLSCRAPE_TRACKERSTATE = 0x0205, 53 TASK_FULLSCRAPE_TRACKERSTATE = 0x0205,
53 54
54 TASK_DMEM = 0x0300, 55 TASK_DMEM = 0x0300,
55 56
56 TASK_DONE = 0x0f00, 57 TASK_DONE = 0x0f00,
57 TASK_DONE_PARTIAL = 0x0f01, 58 TASK_DONE_PARTIAL = 0x0f01,
58 59
59 TASK_FLAG_GZIP = 0x1000, 60 TASK_FLAG_GZIP = 0x1000,
60 TASK_FLAG_BZIP2 = 0x2000, 61 TASK_FLAG_BZIP2 = 0x2000,
61 TASK_FLAG_CHUNKED = 0x4000, 62 TASK_FLAG_CHUNKED = 0x4000,
62 63
63 TASK_TASK_MASK = 0x0fff, 64 TASK_TASK_MASK = 0x0fff,
64 TASK_CLASS_MASK = 0x0f00, 65 TASK_CLASS_MASK = 0x0f00,
65 TASK_FLAGS_MASK = 0xf000 66 TASK_FLAGS_MASK = 0xf000
66} ot_tasktype; 67} ot_tasktype;
67 68
68typedef unsigned long ot_taskid; 69typedef unsigned long ot_taskid;
69 70
70int mutex_workqueue_pushtask( int64 sock, ot_tasktype tasktype ); 71int mutex_workqueue_pushtask(int64 sock, ot_tasktype tasktype);
71void mutex_workqueue_canceltask( int64 sock ); 72void mutex_workqueue_canceltask(int64 sock);
72void mutex_workqueue_pushsuccess( ot_taskid taskid ); 73void mutex_workqueue_pushsuccess(ot_taskid taskid);
73ot_taskid mutex_workqueue_poptask( ot_tasktype *tasktype ); 74ot_taskid mutex_workqueue_poptask(ot_tasktype *tasktype);
74int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iovec *iovector ); 75int mutex_workqueue_pushresult(ot_taskid taskid, int iovec_entries, struct iovec *iovector);
75int mutex_workqueue_pushchunked(ot_taskid taskid, struct iovec *iovec); 76int mutex_workqueue_pushchunked(ot_taskid taskid, struct iovec *iovec);
76int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovector, int *is_partial ); 77int64 mutex_workqueue_popresult(int *iovec_entries, struct iovec **iovector, int *is_partial);
77 78
78#endif 79#endif