Author: nextgens
Date: 2008-04-25 14:44:31 +0000 (Fri, 25 Apr 2008)
New Revision: 19555

Modified:
   trunk/freenet/src/freenet/client/FECCodec.java
Log:
FECCodec: limit the maximum number of FECRunners to 3 so that we don't have any 
problem with open-FileDescriptor limits (1024 seems to be the default at least 
on debian)

Modified: trunk/freenet/src/freenet/client/FECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/FECCodec.java      2008-04-25 08:52:15 UTC 
(rev 19554)
+++ trunk/freenet/src/freenet/client/FECCodec.java      2008-04-25 14:44:31 UTC 
(rev 19555)
@@ -7,7 +7,6 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.LinkedList;
-import java.util.NoSuchElementException;

 import com.onionnetworks.fec.FECCode;
 import com.onionnetworks.util.Buffer;
@@ -375,7 +374,8 @@
                        } else {
                                // Measured 11MB decode 8MB encode on amd64.
                                // No more than 10% of available RAM, so 110MB 
for each extra processor.
-                               max = Math.min(max, (int) 
(Math.min(Integer.MAX_VALUE, maxMemory / (128*1024*1024))));
+                               // No more than 3 so that we don't reach any 
FileDescriptor related limit
+                               max = Math.min(3, Math.min(max, (int) 
(Math.min(Integer.MAX_VALUE, maxMemory / (128*1024*1024)))));
                        }
                        maxRunningFECThreads = max;
                }


Reply via email to