Cleanup
This commit is contained in:
parent
af30f1207d
commit
96693166bc
@ -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() + ": "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user