P2P File Share
A simple peer-to-peer file sharing system.
Loading...
Searching...
No Matches
tracker.cpp File Reference

The tracker. More...

Include dependency graph for tracker.cpp:

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
 

Detailed Description

The tracker.

Usage:

./tracker tracker_info.txt <tracker_no>

tracker info file contains a list of tracker IPs and ports tracker_no is the index of the tracker to use (1 or 2)

Author
Swastik Pal
Date
2024-10-1

Function Documentation

◆ loop()

void loop ( const Endpoint & endpoint,
const std::vector< Endpoint > & trackers )

◆ main()

int main ( int argc,
char * argv[] )

◆ mirror()

void mirror ( const Transaction & transaction,
const std::vector< Endpoint > & trackers )

◆ process_data()

void process_data ( std::shared_ptr< TCPSocket > client,
std::string & data,
const std::vector< Endpoint > & trackers )

◆ sync_with_online_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.

Variable Documentation

◆ successful_transactions

TransactionsRecord successful_transactions