forked from L4nz/ocelot
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathworker.h
38 lines (32 loc) · 1.15 KB
/
worker.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
#include <string>
#include <vector>
#include <list>
#include <unordered_map>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <iostream>
#include <fstream>
#include "site_comm.h"
enum tracker_status { OPEN, PAUSED, CLOSING }; // tracker status
class worker {
private:
site_options_t site_options;
torrent_list torrents_list;
user_list users_list;
std::vector<std::string> blacklist;
config * conf;
mysql * db;
void do_reap_peers();
tracker_status status;
site_comm s_comm;
public:
worker(site_options_t &site_options, torrent_list &torrents, user_list &users, std::vector<std::string> &_blacklist, config * conf_obj, mysql * db_obj, site_comm &sc);
std::string work(std::string &input, std::string &ip);
std::string error(std::string err);
std::string announce(torrent &tor, user &u, std::map<std::string, std::string> ¶ms, std::map<std::string, std::string> &headers, std::string &ip);
std::string scrape(const std::list<std::string> &infohashes);
std::string update(std::map<std::string, std::string> ¶ms);
bool signal(int sig);
tracker_status get_status() { return status; }
void reap_peers();
};