Ignore:
Timestamp:
Dec 21, 2009, 2:30:43 PM (12 years ago)
Author:
livings124
Message:

eliminate the clamp function for now, allow peer connections once again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r9797 r9809  
    816816    return session && session->fdInfo ? session->fdInfo->openFileLimit : -1;
    817817}
    818 
    819 static TR_INLINE int clamp( int val, int lo, int hi )
    820 {
    821     if( val < lo ) val = lo;
    822     if( val > hi ) val = hi;
    823     return val;
    824 }
    825818   
    826819
     
    840833        const int open_max = sysconf( _SC_OPEN_MAX );
    841834        getrlimit( RLIMIT_NOFILE, &rlim );
    842         rlim.rlim_cur = clamp( open_max, 1024, rlim.rlim_max );
     835        rlim.rlim_cur = MIN( MAX( 1024, open_max ), rlim.rlim_max );
    843836        setrlimit( RLIMIT_NOFILE, &rlim );
    844837        tr_dbg( "setrlimit( RLIMIT_NOFILE, %d )", (int)rlim.rlim_cur );
Note: See TracChangeset for help on using the changeset viewer.