Changeset 2503


Ignore:
Timestamp:
Jul 26, 2007, 3:57:45 AM (15 years ago)
Author:
charles
Message:

a better fix for the tr_rand() crash experienced earlier today

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer.c

    r2501 r2503  
    686686               into "pool" to reduce such overlap */
    687687            int piecesLeft = poolSize;
    688             int p = (int)(tr_date() % poolSize);
     688            int p = piecesLeft ? tr_rand(piecesLeft) : 0;
    689689            for( ; openSlots>0 && piecesLeft>0; --piecesLeft, p=(p+1)%poolSize )
    690690            {
  • trunk/libtransmission/utils.c

    r2495 r2503  
    169169{
    170170    static int init = 0;
     171
     172    assert( sup > 0 );
     173
    171174    if( !init )
    172175    {
Note: See TracChangeset for help on using the changeset viewer.