From 96693166bcdec4a423ff9f000e365ac16c4fd810 Mon Sep 17 00:00:00 2001 From: senft-lap Date: Wed, 21 Nov 2012 12:25:57 +0100 Subject: [PATCH] Cleanup --- ws2012/P2P/uebungen/4/src/peer/Node.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ws2012/P2P/uebungen/4/src/peer/Node.java b/ws2012/P2P/uebungen/4/src/peer/Node.java index 04e2333b..ab8082d4 100644 --- a/ws2012/P2P/uebungen/4/src/peer/Node.java +++ b/ws2012/P2P/uebungen/4/src/peer/Node.java @@ -1,15 +1,12 @@ package peer; import java.io.IOException; -import java.net.Inet4Address; -import java.net.Inet6Address; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; import java.util.ArrayList; import java.util.List; -import java.util.Random; import java.util.logging.Logger; import common.MessageType; @@ -100,9 +97,10 @@ public class Node { * Circularly link all neighbors, remove itself form all neighbors and exit. */ public void leave() { - System.out.println(neighbors); - - LOGGER.info("Name: " + getName() + ", Leaving..."); + // System.out.println(neighbors); + + LOGGER.info("Name: " + getName() + + ", Leaving... Announcing to my neighbors: " + neighbors); for (int i = 0; i < neighbors.size(); i++) { @@ -182,11 +180,9 @@ public class Node { private volatile boolean running = true; public void run() { - StringBuilder sb_received; while (running) { SocketAddress receivedFrom = null; - buf.clear(); try { receivedFrom = channel.receive(buf); @@ -247,6 +243,7 @@ public class Node { break; default: + System.out.println(messageType); LOGGER.info(name + " received unknown command from " + receivedFrom.toString() + ": "