(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:
parent
0e79d23b2c
commit
36019841b8
|
@ -22,10 +22,6 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
#define HAVE_GETRLIMIT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
@ -42,10 +38,6 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef HAVE_GETRLIMIT
|
|
||||||
#include <sys/time.h> /* getrlimit */
|
|
||||||
#include <sys/resource.h> /* getrlimit */
|
|
||||||
#endif
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h> /* O_LARGEFILE */
|
#include <fcntl.h> /* O_LARGEFILE */
|
||||||
|
|
||||||
|
@ -508,20 +500,7 @@ tr_fdInit( int globalPeerLimit )
|
||||||
assert( gFd == NULL );
|
assert( gFd == NULL );
|
||||||
gFd = tr_new0( struct tr_fd_s, 1 );
|
gFd = tr_new0( struct tr_fd_s, 1 );
|
||||||
gFd->lock = tr_lockNew( );
|
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;
|
gFd->socketMax = globalPeerLimit;
|
||||||
#endif
|
|
||||||
tr_dbg( "%d usable file descriptors", globalPeerLimit );
|
tr_dbg( "%d usable file descriptors", globalPeerLimit );
|
||||||
|
|
||||||
for( i = 0; i < TR_MAX_OPEN_FILES; ++i )
|
for( i = 0; i < TR_MAX_OPEN_FILES; ++i )
|
||||||
|
|
Loading…
Reference in New Issue