X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/96cedde3cdbc0b8ffc3f096a1b65d021b0226f99..ae445ab5a97e0d537feb8ee9a9d49a75270cf70d:/examples/s4u/app-bittorrent/s4u-tracker.hpp diff --git a/examples/s4u/app-bittorrent/s4u-tracker.hpp b/examples/s4u/app-bittorrent/s4u-tracker.hpp index 27c025e584..08fd911f3a 100644 --- a/examples/s4u/app-bittorrent/s4u-tracker.hpp +++ b/examples/s4u/app-bittorrent/s4u-tracker.hpp @@ -1,42 +1,38 @@ -/* Copyright (c) 2012-2019. The SimGrid Team. +/* Copyright (c) 2012-2020. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#ifndef BITTORRENT_TRACKER_HPP_ -#define BITTORRENT_TRACKER_HPP_ +#ifndef BITTORRENT_TRACKER_HPP +#define BITTORRENT_TRACKER_HPP #include "s4u-bittorrent.hpp" #include class TrackerQuery { int peer_id; // peer id - simgrid::s4u::MailboxPtr return_mailbox; + simgrid::s4u::Mailbox* return_mailbox; + public: - explicit TrackerQuery(int peer_id, simgrid::s4u::MailboxPtr return_mailbox) + explicit TrackerQuery(int peer_id, simgrid::s4u::Mailbox* return_mailbox) : peer_id(peer_id), return_mailbox(return_mailbox){}; - ~TrackerQuery() = default; int getPeerId() { return peer_id; } - simgrid::s4u::MailboxPtr getReturnMailbox() { return return_mailbox; } + simgrid::s4u::Mailbox* getReturnMailbox() { return return_mailbox; } }; class TrackerAnswer { // int interval; // how often the peer should contact the tracker (unused for now) - std::set* peers; // the peer list the peer has asked for. + std::set peers; // the peer list the peer has asked for. public: - explicit TrackerAnswer(int /*interval*/) /*: interval(interval)*/ { peers = new std::set; } - TrackerAnswer(const TrackerAnswer&) = delete; - TrackerAnswer& operator=(const TrackerAnswer&) = delete; - ~TrackerAnswer() { delete peers; }; - void addPeer(int peer) { peers->insert(peer); } - std::set* getPeers() { return peers; } + explicit TrackerAnswer(int /*interval*/) /*: interval(interval)*/ {} + void addPeer(int peer) { peers.insert(peer); } + const std::set& getPeers() { return peers; } }; class Tracker { double deadline; - RngStream stream; - simgrid::s4u::MailboxPtr mailbox; + simgrid::s4u::Mailbox* mailbox; std::set known_peers; public: