mirror of
https://github.com/transmission/transmission
synced 2025-02-21 21:57:01 +00:00
eliminate the clamp function for now, allow peer connections once again
This commit is contained in:
parent
526f8006eb
commit
25a023023f
1 changed files with 1 additions and 8 deletions
|
@ -815,13 +815,6 @@ tr_fdGetFileLimit( const tr_session * session )
|
||||||
{
|
{
|
||||||
return session && session->fdInfo ? session->fdInfo->openFileLimit : -1;
|
return session && session->fdInfo ? session->fdInfo->openFileLimit : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TR_INLINE int clamp( int val, int lo, int hi )
|
|
||||||
{
|
|
||||||
if( val < lo ) val = lo;
|
|
||||||
if( val > hi ) val = hi;
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -839,7 +832,7 @@ tr_fdSetPeerLimit( tr_session * session, int socketLimit )
|
||||||
const int NOFILE_BUFFER = 512;
|
const int NOFILE_BUFFER = 512;
|
||||||
const int open_max = sysconf( _SC_OPEN_MAX );
|
const int open_max = sysconf( _SC_OPEN_MAX );
|
||||||
getrlimit( RLIMIT_NOFILE, &rlim );
|
getrlimit( RLIMIT_NOFILE, &rlim );
|
||||||
rlim.rlim_cur = clamp( open_max, 1024, rlim.rlim_max );
|
rlim.rlim_cur = MIN( MAX( 1024, open_max ), rlim.rlim_max );
|
||||||
setrlimit( RLIMIT_NOFILE, &rlim );
|
setrlimit( RLIMIT_NOFILE, &rlim );
|
||||||
tr_dbg( "setrlimit( RLIMIT_NOFILE, %d )", (int)rlim.rlim_cur );
|
tr_dbg( "setrlimit( RLIMIT_NOFILE, %d )", (int)rlim.rlim_cur );
|
||||||
gFd->socketLimit = MIN( socketLimit, (int)rlim.rlim_cur - NOFILE_BUFFER );
|
gFd->socketLimit = MIN( socketLimit, (int)rlim.rlim_cur - NOFILE_BUFFER );
|
||||||
|
|
Loading…
Reference in a new issue