Changeset 9051 for branches


Ignore:
Timestamp:
Sep 7, 2009, 6:19:26 AM (13 years ago)
Author:
charles
Message:

backport from trunk to 1.7x the fixes for tickets #2326, #2365, #2372, #2373, #2383, #2384, and unticketed change r9047

Location:
branches/1.7x
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/1.7x/configure.ac

    r8997 r9051  
    2626    CXXFLAGS="$CXXFLAGS -g -O3 "
    2727  fi
     28  CPPFLAGS="$CPPFLAGS -NDEBUG"
    2829else
    2930  supported_build=no
  • branches/1.7x/libtransmission/bencode.c

    r8903 r9051  
    13401340                    UTF32 *      u32 = &buf;
    13411341                    ConversionResult result = ConvertUTF8toUTF32( &tmp, end, &u32, &buf + 1, 0 );
    1342                     if( ( result != conversionOK ) && ( tmp == it ) )
    1343                         ++it; /* it's beyond help; skip it */
    1344                     else {
     1342                    if((( result==conversionOK ) || (result==targetExhausted)) && (tmp!=it)) {
    13451343                        evbuffer_add_printf( data->out, "\\u%04x", (unsigned int)buf );
    13461344                        it = tmp - 1;
  • branches/1.7x/libtransmission/peer-mgr.c

    r8912 r9051  
    24752475{
    24762476    int n = tr_ptrArraySize( &t->peers );
    2477     const int max = tr_sessionGetPeerLimitPerTorrent( t->tor->session );
     2477    const int max = tr_torrentGetPeerLimit( t->tor );
    24782478    if( n > max )
    24792479    {
     
    26082608    tor = NULL;
    26092609    while(( tor = tr_torrentNext( mgr->session, tor )))
    2610         if( tor->isRunning && (( tor->error == TR_STAT_TRACKER_ERROR ) || ( tor->error == TR_STAT_LOCAL_ERROR )))
     2610        if( tor->isRunning && ( tor->error == TR_STAT_LOCAL_ERROR ))
    26112611            tr_torrentStop( tor );
    26122612
  • branches/1.7x/libtransmission/torrent.c

    r8948 r9051  
    720720    didParse = tr_metainfoParse( session, setmeInfo, metainfo );
    721721    doFree = didParse && ( setmeInfo == &tmp );
     722
     723    if( !didParse )
     724        result = TR_PARSE_ERR;
    722725
    723726    if( didParse && !getBlockSize( setmeInfo->pieceSize ) )
  • branches/1.7x/libtransmission/tracker.c

    r8905 r9051  
    525525                                      tr_webGetResponseStr( responseCode ) );
    526526        tr_strlcpy( t->lastAnnounceStr, buf, sizeof( t->lastAnnounceStr ) );
    527         publishWarning( t, buf );
     527
     528        /* if the repsonse may require intervention, notify the user; otherwise, just log it */
     529        if( responseCode >= 400 )
     530            publishWarning( t, buf );
     531        tr_ninf( t->name, "%s", buf );
     532
    528533        tr_free( buf );
    529534    }
  • branches/1.7x/libtransmission/verify.c

    r8931 r9051  
    3636***/
    3737
     38enum
     39{
     40    MSEC_TO_SLEEP_PER_SECOND_DURING_VERIFY = 200
     41};
     42
    3843/* #define STOPWATCH */
    3944
     
    4651    tr_bool changed = 0;
    4752    tr_bool hadPiece = 0;
     53    time_t lastSleptAt = 0;
    4854    uint32_t piecePos = 0;
    4955    uint32_t pieceBytesRead = 0;
     
    5359    uint8_t * buffer = tr_new( uint8_t, buflen );
    5460#ifdef STOPWATCH
    55     time_t now = time( NULL );
     61    const time_t begin = time( NULL );
    5662#endif
    5763
     
    106112        if( leftInPiece == 0 )
    107113        {
     114            time_t now;
    108115            tr_bool hasPiece;
    109116            uint8_t hash[SHA_DIGEST_LENGTH];
     
    122129            }
    123130            tr_torrentSetPieceChecked( tor, pieceIndex, TRUE );
    124             tor->anyDate = time( NULL );
    125 
    126             /* going full-throttle on a verify can choke other processes'
    127              * disk IO, so wait a fwe msec between pieces.
    128              * The msec is arbitrary, and the "if" clause is to make sure we
    129              * don't slow down verification of files that don't exist */
    130             if( pieceBytesRead == tr_torPieceCountBytes( tor, pieceIndex ) )
    131                 tr_wait( 50 );
     131            now = time( NULL );
     132            tor->anyDate = now;
     133
     134            /* sleeping even just a few msec per second goes a long
     135             * way towards reducing IO load... */
     136            if( lastSleptAt != now ) {
     137                lastSleptAt = now;
     138                tr_wait( MSEC_TO_SLEEP_PER_SECOND_DURING_VERIFY );
     139            }
    132140
    133141            SHA1_Init( &sha );
     
    154162#ifdef STOPWATCH
    155163{
    156     time_t now2 = time( NULL );
     164    const time_t end = time( NULL );
    157165    fprintf( stderr, "it took %d seconds to verify %"PRIu64" bytes (%"PRIu64" bytes per second)\n",
    158              (int)(now2-now), tor->info.totalSize, (uint64_t)(tor->info.totalSize/(1+(now2-now))) );
     166             (int)(end-begin), tor->info.totalSize, (uint64_t)(tor->info.totalSize/(1+(end-begin))) );
    159167}
    160168#endif
Note: See TracChangeset for help on using the changeset viewer.