Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / examples / java / dht / kademlia / RoutingTable.java
index c5f88b2..0216915 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, 2016. 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
@@ -67,7 +67,8 @@ public class RoutingTable {
       Msg.debug("Adding " + id + " to my routing table");
       bucket.add(id);
       if (bucket.size() > Common.BUCKET_SIZE)  {
-        //TODO: Ping the least seen guy and remove him if he is offline.
+        // TODO
+        Msg.debug("Should ping the least seen guy and remove him if he is offline.");
       }
     }
   }
@@ -94,9 +95,8 @@ public class RoutingTable {
     //We sort the list
     Collections.sort(answer.getNodes());
     //We trim the list
-    while (answer.size() > Common.BUCKET_SIZE) {
-      answer.remove(answer.size() - 1); //TODO: Not the best thing.
-    }
+    answer.trim();
+
     return answer;
   }