Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenml committed Feb 19, 2016
1 parent c4b4aae commit 82be7fd
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -153,6 +153,10 @@ public void announcePeer(Sha1Hash infoHash, TcpEndpoint endp, String name, boole
}
v.peers.add(peer);
counters.peers += 1;

if (print) {
print("announce_peer", "Name: " + name);
}
}

@Override
Expand Down Expand Up @@ -192,6 +196,10 @@ public void putImmutableItem(Sha1Hash target, byte[] buf, Address addr) {
}

touchItem(i, addr.swig());

if (print) {
print("put_immutable_item", "From: " + addr);
}
}

@Override
Expand Down Expand Up @@ -260,6 +268,10 @@ public int compare(Map.Entry<Sha1Hash, DhtMutableItem> o1, Map.Entry<Sha1Hash, D
}

touchItem(i, addr.swig());

if (print) {
print("put_mutable_item", "From: " + addr);
}
}

@Override
Expand Down Expand Up @@ -333,6 +345,11 @@ private static void print(String operation, entry entry) {
System.out.println(entry.to_string());
}

private static void print(String operation, String msg) {
System.out.println("DHT OP: " + operation);
System.out.println(msg);
}

private static void touchItem(DhtImmutableItem f, address address) {
f.last_seen = System.currentTimeMillis();

Expand Down

0 comments on commit 82be7fd

Please sign in to comment.