1 /* Copyright (c) 2012-2023. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #ifndef BITTORRENT_TRACKER_HPP
8 #define BITTORRENT_TRACKER_HPP
10 #include "s4u-bittorrent.hpp"
14 int peer_id; // peer id
15 simgrid::s4u::Mailbox* return_mailbox;
18 explicit TrackerQuery(int peer_id, simgrid::s4u::Mailbox* return_mailbox)
19 : peer_id(peer_id), return_mailbox(return_mailbox){};
20 int getPeerId() const { return peer_id; }
21 simgrid::s4u::Mailbox* getReturnMailbox() const { return return_mailbox; }
25 // int interval; // how often the peer should contact the tracker (unused for now)
26 std::set<int> peers; // the peer list the peer has asked for.
28 explicit TrackerAnswer(int /*interval*/) /*: interval(interval)*/ {}
29 void addPeer(int peer) { peers.insert(peer); }
30 const std::set<int>& getPeers() const { return peers; }
35 simgrid::xbt::random::XbtRandom random{42};
36 simgrid::s4u::Mailbox* mailbox;
37 std::set<int> known_peers;
40 explicit Tracker(std::vector<std::string> args);
44 #endif /* BITTORRENT_TRACKER_HPP */