forked from mifune/ocelot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathocelot.h
58 lines (49 loc) · 1.14 KB
/
ocelot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <string>
#include <map>
#include <vector>
#include <unordered_map>
#include <set>
#include <boost/thread/thread.hpp>
typedef struct {
time_t freeleech;
} site_options_t;
typedef struct {
int userid;
std::string peer_id;
std::string user_agent;
std::string ip_port;
std::string ip;
unsigned int port;
long long uploaded;
long long downloaded;
uint64_t left;
time_t last_announced;
time_t first_announced;
unsigned int announces;
} peer;
typedef std::map<std::string, peer> peer_list;
enum freetype { NORMAL, FREE, NEUTRAL };
typedef struct {
time_t free_leech;
time_t double_seed;
} slots_t;
typedef struct {
int id;
time_t last_seeded;
long long balance;
int completed;
freetype free_torrent;
bool double_seed;
std::map<std::string, peer> seeders;
std::map<std::string, peer> leechers;
std::string last_selected_seeder;
std::map<int, slots_t> tokened_users;
time_t last_flushed;
} torrent;
typedef struct {
int id;
bool can_leech;
time_t pfl; // personal freeleech
} user;
typedef std::unordered_map<std::string, torrent> torrent_list;
typedef std::unordered_map<std::string, user> user_list;