1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 16:24:02 +00:00

(libT) don't use getrlimit() / setrlimit() anymore. this doesn't do much good and could possibly do harm wrt fighting with libcurl for available sockets.

This commit is contained in:
Charles Kerr 2008-11-12 04:05:27 +00:00
parent 0e79d23b2c
commit 36019841b8

View file

@ -22,10 +22,6 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#ifndef WIN32
#define HAVE_GETRLIMIT
#endif
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
@ -42,10 +38,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_GETRLIMIT
#include <sys/time.h> /* getrlimit */
#include <sys/resource.h> /* getrlimit */
#endif
#include <unistd.h>
#include <fcntl.h> /* O_LARGEFILE */
@ -508,20 +500,7 @@ tr_fdInit( int globalPeerLimit )
assert( gFd == NULL );
gFd = tr_new0( struct tr_fd_s, 1 );
gFd->lock = tr_lockNew( );
#ifdef HAVE_GETRLIMIT
{
struct rlimit rlim;
getrlimit( RLIMIT_NOFILE, &rlim );
rlim.rlim_cur = MIN( rlim.rlim_max,
(rlim_t)( globalPeerLimit + NOFILE_BUFFER ) );
setrlimit( RLIMIT_NOFILE, &rlim );
gFd->socketMax = rlim.rlim_cur - NOFILE_BUFFER;
tr_dbg( "setrlimit( RLIMIT_NOFILE, %d )", (int)rlim.rlim_cur );
}
#else
gFd->socketMax = globalPeerLimit;
#endif
tr_dbg( "%d usable file descriptors", globalPeerLimit );
for( i = 0; i < TR_MAX_OPEN_FILES; ++i )