Ignore:
Timestamp:
Dec 24, 2007, 7:02:40 AM (14 years ago)
Author:
charles
Message:

(gtk) fix startup port issue by hitting it with a damn big hammer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r4255 r4311  
    8787enum
    8888{
    89     TR_MAX_PEER_SOCKETS = 512,
    90 
    9189    TR_MAX_OPEN_FILES = 16, /* real files, not sockets */
    9290
     
    453451
    454452void
    455 tr_fdInit( void )
    456 {
    457     int i, j, s[TR_MAX_PEER_SOCKETS];
     453tr_fdInit( int globalPeerLimit )
     454{
     455    int i, j, *s;
    458456
    459457    assert( gFd == NULL );
     
    462460    gFd->lock = tr_lockNew( );
    463461
     462    s = tr_new( int, globalPeerLimit );
     463
    464464    /* count the max number of sockets we can use */
    465     for( i=0; i<TR_MAX_PEER_SOCKETS; ++i )
     465    for( i=0; i<globalPeerLimit; ++i )
    466466        if( ( s[i] = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 )
    467467            break;
     
    475475    for( i=0; i<TR_MAX_OPEN_FILES; ++i )
    476476        gFd->open[i].fd = -1;
    477          
     477
     478    tr_free( s );
    478479}
    479480
     
    503504tr_fdGetPeerLimit( void )
    504505{
    505     return gFd ? gFd->normalMax : TR_MAX_PEER_SOCKETS;
    506 }
     506    return gFd ? gFd->normalMax : -1;
     507}
Note: See TracChangeset for help on using the changeset viewer.