]> granicus.if.org Git - pdns/commitdiff
our messages on filedescriptors were hard to understand
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 1 Dec 2015 10:41:09 +0000 (11:41 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 1 Dec 2015 10:41:09 +0000 (11:41 +0100)
pdns/pdns_recursor.cc

index 8da6b6a677de68d5abc8895e99acc37d3693f162..8f063f28bd1748e2f06a47f8bb457dbe1e50e23c 100644 (file)
@@ -2005,15 +2005,16 @@ static void checkOrFixFDS()
   unsigned int wantFDs = g_maxMThreads * g_numWorkerThreads +25; // even healthier margin then before
 
   if(wantFDs > availFDs) {
-    if(getFilenumLimit(true) >= wantFDs) {
+    unsigned int hardlimit= getFilenumLimit(true);
+    if(hardlimit >= wantFDs) {
       setFilenumLimit(wantFDs);
       L<<Logger::Warning<<"Raised soft limit on number of filedescriptors to "<<wantFDs<<" to match max-mthreads and threads settings"<<endl;
     }
     else {
-      int newval = getFilenumLimit(true) / g_numWorkerThreads;
-      L<<Logger::Warning<<"Insufficient number of filedescriptors available for max-mthreads*threads setting! ("<<availFDs<<" < "<<wantFDs<<"), reducing max-mthreads to "<<newval<<endl;
+      int newval = (hardlimit - 25) / g_numWorkerThreads;
+      L<<Logger::Warning<<"Insufficient number of filedescriptors available for max-mthreads*threads setting! ("<<hardlimit<<" < "<<wantFDs<<"), reducing max-mthreads to "<<newval<<endl;
       g_maxMThreads = newval;
-      setFilenumLimit(getFilenumLimit(true));
+      setFilenumLimit(hardlimit);
     }
   }
 }