From 2224eb6eb7c0aaa97c9952b1d58a8be7846c375a Mon Sep 17 00:00:00 2001 From: a-pavlov Date: Sat, 7 Jan 2017 22:18:19 +0500 Subject: [PATCH] Fix bug in refresh - refreshing was always on self id instead of if passed from needRefresh method --- core/src/main/java/org/dkf/jed2k/kad/NodeImpl.java | 2 +- core/src/main/java/org/dkf/jed2k/kad/RoutingTable.java | 2 +- .../dkf/jed2k/kad/traversal/algorithm/FindData.java | 2 +- .../org/dkf/jed2k/kad/traversal/algorithm/Refresh.java | 2 +- core/src/main/resources/logging.properties | 10 ++++++---- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/dkf/jed2k/kad/NodeImpl.java b/core/src/main/java/org/dkf/jed2k/kad/NodeImpl.java index 90023ab5..90c12330 100644 --- a/core/src/main/java/org/dkf/jed2k/kad/NodeImpl.java +++ b/core/src/main/java/org/dkf/jed2k/kad/NodeImpl.java @@ -123,7 +123,7 @@ public void searchNotes(final KadId id) { public void refresh(final KadId id) throws JED2KException { assert id != null; log.debug("[node] refresh on target {}", id); - Traversal t = new Refresh(this, self); + Traversal t = new Refresh(this, id); t.start(); } diff --git a/core/src/main/java/org/dkf/jed2k/kad/RoutingTable.java b/core/src/main/java/org/dkf/jed2k/kad/RoutingTable.java index 9c431ee3..47ca76df 100644 --- a/core/src/main/java/org/dkf/jed2k/kad/RoutingTable.java +++ b/core/src/main/java/org/dkf/jed2k/kad/RoutingTable.java @@ -171,7 +171,7 @@ public int compare(RoutingTableBucket lhs, RoutingTableBucket rhs) { } if (now - lastRefresh < Time.seconds(45)) { - log.debug("[table] bucket {} has last refresh too recently {}", i, now - lastRefresh); + log.trace("[table] bucket {} has last refresh too recently {}", i, now - lastRefresh); return null; } diff --git a/core/src/main/java/org/dkf/jed2k/kad/traversal/algorithm/FindData.java b/core/src/main/java/org/dkf/jed2k/kad/traversal/algorithm/FindData.java index 4fd8acba..017fa7e9 100644 --- a/core/src/main/java/org/dkf/jed2k/kad/traversal/algorithm/FindData.java +++ b/core/src/main/java/org/dkf/jed2k/kad/traversal/algorithm/FindData.java @@ -60,7 +60,7 @@ public int compare(NodeEntry o1, NodeEntry o2) { assert sorted; - log.debug("[find data] initial size {}", results.size()); + log.debug("[find data] for {} initial size {}", getTarget(), results.size()); } /** diff --git a/core/src/main/java/org/dkf/jed2k/kad/traversal/algorithm/Refresh.java b/core/src/main/java/org/dkf/jed2k/kad/traversal/algorithm/Refresh.java index 6ac1e7ca..23728329 100644 --- a/core/src/main/java/org/dkf/jed2k/kad/traversal/algorithm/Refresh.java +++ b/core/src/main/java/org/dkf/jed2k/kad/traversal/algorithm/Refresh.java @@ -34,7 +34,7 @@ public String getName() { @Override public void done() { // just remove algorithm from node - log.debug("[refresh] done"); + log.debug("[refresh] {} done", getTarget()); nodeImpl.removeTraversalAlgorithm(this); } } diff --git a/core/src/main/resources/logging.properties b/core/src/main/resources/logging.properties index 8e0a11c5..d6110c3e 100644 --- a/core/src/main/resources/logging.properties +++ b/core/src/main/resources/logging.properties @@ -1,9 +1,11 @@ handlers=java.util.logging.ConsoleHandler java.util.logging.ConsoleHandler.level=FINEST -.level=FINE +.level=INFO org.dkf.jed2k.kad.DhtTracker.level=INFO org.dkf.jed2k.kad.NodeImpl.level=FINE -org.dkf.jed2k.kad.RoutingTable.level=INFO -org.dkf.jed2k.kad.RpcManager.level=FINE -org.dkf.jed2k.kad.traversal.algorithm.Traversal.level=FINE +org.dkf.jed2k.kad.RoutingTable.level=FINE +org.dkf.jed2k.kad.RpcManager.level=INFO +org.dkf.jed2k.kad.traversal.algorithm.Traversal.level=INFO +org.dkf.jed2k.kad.traversal.algorithm.Refresh.level=FINE +org.dkf.jed2k.kad.traversal.observer.Observer.level=FINE #-Djava.util.logging.config.file=C:\dev\jed2k\core\src\main\resources\logging.properties \ No newline at end of file