Ignore:
Timestamp:
Apr 16, 2011, 10:33:29 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #4165 "FD_SETSIZE impact on open-file-limit and peer-limit-global" -- add safety guard in the file cache to prevent too many open files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r12229 r12363  
    747747tr_fdSetFileLimit( tr_session * session, int limit )
    748748{
     749    int max;
     750
     751    /* This is a vaguely arbitrary number.
     752       It takes announcer.c's MAX_CONCURRENT_TASKS into account,
     753       plus extra positions for the listening sockets,
     754       plus a few more just to be safe */
     755    const int buffer_slots = 128;
     756
    749757    ensureSessionFdInfoExists( session );
     758
     759    max = __FD_SETSIZE - session->fdInfo->socket_limit - buffer_slots;
     760    if( limit > max )
     761        limit = max;
    750762
    751763    if( limit != tr_fdGetFileLimit( session ) )
Note: See TracChangeset for help on using the changeset viewer.