P2P File Share
A simple peer-to-peer file sharing system.
|
The tracker. More...
#include "../common/load_tracker_info.cpp"
#include "../network/network_errors.hpp"
#include "../network/tcp_server.hpp"
#include "parse_request.hpp"
#include "process_request.hpp"
#include "transactionsrecord.hpp"
Functions | |
void | mirror (const Transaction &transaction, const std::vector< Endpoint > &trackers) |
void | process_data (std::shared_ptr< TCPSocket > client, std::string &data, const std::vector< Endpoint > &trackers) |
bool | sync_with_online_trackers (const std::vector< Endpoint > &trackers) |
Attempt to connect to any of the trackers, get the list of successful transactions, and execute them on this tracker to bring it up to date. | |
void | loop (const Endpoint &endpoint, const std::vector< Endpoint > &trackers) |
int | main (int argc, char *argv[]) |
Variables | |
TransactionsRecord | successful_transactions |
The tracker.
Usage:
tracker info file contains a list of tracker IPs and ports tracker_no is the index of the tracker to use (1 or 2)
int main | ( | int | argc, |
char * | argv[] ) |
void mirror | ( | const Transaction & | transaction, |
const std::vector< Endpoint > & | trackers ) |
void process_data | ( | std::shared_ptr< TCPSocket > | client, |
std::string & | data, | ||
const std::vector< Endpoint > & | trackers ) |
bool sync_with_online_trackers | ( | const std::vector< Endpoint > & | trackers | ) |
Attempt to connect to any of the trackers, get the list of successful transactions, and execute them on this tracker to bring it up to date.
TransactionsRecord successful_transactions |