Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / examples / deprecated / java / dht / chord / Node.java
index e201df9..f3bb660 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-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. */
@@ -305,13 +305,12 @@ public class Node extends Process {
   // It refreshes the finger table of the current node.
   private void fixFingers() {
     Msg.debug("Fixing fingers");
-    int i = this.nextFingerToFix;
-    int successorId = this.findSuccessor(this.id + (int)Math.pow(2,i)); //FIXME: SLOW
+    int successorId = findSuccessor(id + (1 << nextFingerToFix));
     if (successorId != -1) {
-      if (successorId != fingers[i]) {
-        setFinger(i, successorId);
+      if (successorId != fingers[nextFingerToFix]) {
+        setFinger(nextFingerToFix, successorId);
       }
-      nextFingerToFix = (i + 1) % Common.NB_BITS;
+      nextFingerToFix = (nextFingerToFix + 1) % Common.NB_BITS;
     }
   }