Logo Search packages:      
Sourcecode: condor version File versions  Download package

int DaemonCore::FileDescriptorSafetyLimit (  ) 

Returns:
Maximum number of persistent file descriptors that we should ever attempt having open at the same time.

Definition at line 613 of file daemon_core.cpp.

Referenced by TooManyRegisteredSockets().

{
      if( file_descriptor_safety_limit == 0 ) {
                  // Our max is the maxiumum file descriptor that our Selector
                  // class says it can handle.
            int file_descriptor_max = Selector::fd_select_size();
            // Set the danger level at 80% of the max
            file_descriptor_safety_limit = file_descriptor_max - file_descriptor_max/5;
            if( file_descriptor_safety_limit < MIN_FILE_DESCRIPTOR_SAFETY_LIMIT ) {
                        // There is no point trying to live within this limit,
                        // because it is too small.  It is better to try and fail
                        // in this case than to trust this limit.
                  file_descriptor_safety_limit = MIN_FILE_DESCRIPTOR_SAFETY_LIMIT;
            }

            int p = param_integer( "NETWORK_MAX_PENDING_CONNECTS", 0 );
            if( p!=0 ) {
                  file_descriptor_safety_limit = p;
            }

            dprintf(D_FULLDEBUG,"File descriptor limits: max %d, safe %d\n",
                        file_descriptor_max,
                        file_descriptor_safety_limit);
      }

      return file_descriptor_safety_limit;
}


Generated by  Doxygen 1.6.0   Back to index