Author: toad
Date: 2007-06-29 20:52:07 +0000 (Fri, 29 Jun 2007)
New Revision: 13832
Modified:
trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
Log:
Support closing UdpSocketHandler's
Modified: trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java 2007-06-29
20:46:28 UTC (rev 13831)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java 2007-06-29
20:52:07 UTC (rev 13832)
@@ -35,6 +35,7 @@
private static boolean logMINOR;
private volatile int lastTimeInSeconds;
private boolean _isDone;
+ private boolean _active = true;
public UdpSocketHandler(int listenPort, InetAddress bindto, Node node)
throws SocketException {
super("MessageCore packet receiver thread on port " +
listenPort);
@@ -115,7 +116,7 @@
DatagramPacket packet = new DatagramPacket(buf, buf.length);
while (/*_active*/true) {
synchronized(this) {
- if(_isDone) return; // Finished
+ if(!_active) return; // Finished
}
try {
lastTimeInSeconds = (int)
(System.currentTimeMillis() / 1000);
@@ -329,6 +330,7 @@
public void close(boolean exit) {
Logger.error(this, "Closing.", new Exception("error"));
synchronized (this) {
+ _active = false;
while (!_isDone) {
try {
wait(2000);