[freenet-cvs] r11659 - trunk/freenet/src/freenet/io/comm

toad at freenetproject.org toad at freenetproject.org
Sat Feb 3 16:04:57 UTC 2007


Author: toad
Date: 2007-02-03 16:04:57 +0000 (Sat, 03 Feb 2007)
New Revision: 11659

Modified:
   trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
Log:
Optimisation was broken (not working; no impact on function)

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketManager.java	2007-02-03 15:35:24 UTC (rev 11658)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketManager.java	2007-02-03 16:04:57 UTC (rev 11659)
@@ -198,10 +198,12 @@
 	}
 
 	private void runLoop() {
+		byte[] buf = new byte[MAX_RECEIVE_SIZE];
+		DatagramPacket packet = new DatagramPacket(buf, buf.length);
 		while (/*_active*/true) {
 			try {
 				lastTimeInSeconds = (int) (System.currentTimeMillis() / 1000);
-				realRun();
+				realRun(packet);
             } catch (OutOfMemoryError e) {
 				OOMHandler.handleOOM(e);
 				System.err.println("Will retry above failed operation...");
@@ -213,10 +215,8 @@
 		}
 	}
 	
-	private void realRun() {
+	private void realRun(DatagramPacket packet) {
 		// Single receiving thread
-		byte[] buf = new byte[MAX_RECEIVE_SIZE];
-		DatagramPacket packet = new DatagramPacket(buf, buf.length);
 		boolean gotPacket = getPacket(packet);
 		// Check for timedout _filters
 		removeTimedOutFilters();




More information about the cvs mailing list