X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/08a8ba5b7ccd6f4aa2393fd6c8e32267121314f1..329535631662ebf730c23f762762d38bf16663c3:/examples/s4u/dht-kademlia/node.hpp diff --git a/examples/s4u/dht-kademlia/node.hpp b/examples/s4u/dht-kademlia/node.hpp index 178f380a88..a9f5bf9eaf 100644 --- a/examples/s4u/dht-kademlia/node.hpp +++ b/examples/s4u/dht-kademlia/node.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, 2014-2018. The SimGrid Team. +/* Copyright (c) 2012-2019. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -15,26 +15,25 @@ namespace kademlia { class Node { unsigned int id_; // node id - 160 bits - RoutingTable* table = nullptr; // node routing table + RoutingTable table; // node routing table public: - simgrid::s4u::CommPtr receive_comm; + simgrid::s4u::CommPtr receive_comm = nullptr; void* received_msg = nullptr; unsigned int find_node_success = 0; // Number of find_node which have succeeded. unsigned int find_node_failed = 0; // Number of find_node which have failed. - explicit Node(unsigned int node_id) : id_(node_id), table(new RoutingTable(node_id)), receive_comm(nullptr) {} + explicit Node(unsigned int node_id) : id_(node_id), table(node_id) {} Node(const Node&) = delete; Node& operator=(const Node&) = delete; - ~Node() { delete table; } unsigned int getId() { return id_; } bool join(unsigned int known_id); void sendFindNode(unsigned int id, unsigned int destination); - unsigned int sendFindNodeToBest(Answer* node_list); + unsigned int sendFindNodeToBest(const Answer* node_list); void routingTableUpdate(unsigned int id); Answer* findClosest(unsigned int destination_id); bool findNode(unsigned int id_to_find, bool count_in_stats); void randomLookup(); - void handleFindNode(Message* msg); + void handleFindNode(const Message* msg); }; } // identifier functions