Changeset 5750


Ignore:
Timestamp:
May 6, 2008, 1:43:24 AM (14 years ago)
Author:
charles
Message:

#912: Resume file parsed twice on startup

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/add-dialog.c

    r5604 r5750  
    206206    gtk_label_set_mnemonic_widget( GTK_LABEL( l ), w );
    207207    addTorrentFilters( GTK_FILE_CHOOSER( w ) );
    208     g_signal_connect( w, "selection-changed",
    209                       G_CALLBACK( sourceChanged ), data );
    210208    if( data->filename )
    211209        if( !gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( w ), data->filename ) )
    212210            g_warning( "couldn't select '%s'", data->filename );
     211    g_signal_connect( w, "selection-changed",
     212                      G_CALLBACK( sourceChanged ), data );
    213213
    214214    ++row;
  • trunk/libtransmission/torrent.c

    r5749 r5750  
    358358}
    359359
     360static void torrentStart( tr_torrent * tor, int reloadProgress );
     361
    360362static void
    361363torrentRealInit( tr_handle     * h,
     
    478480
    479481    if( doStart )
    480         tr_torrentStart( tor );
     482        torrentStart( tor, FALSE );
    481483}
    482484
     
    551553tr_torrentSetFolder( tr_torrent * tor, const char * path )
    552554{
    553     tr_free( tor->destination );
    554     tor->destination = tr_strdup( path );
    555     tr_torrentSaveResume( tor );
     555    if( !path || !tor->destination || strcmp( path, tor->destination ) )
     556    {
     557        tr_free( tor->destination );
     558        tor->destination = tr_strdup( path );
     559        tr_torrentSaveResume( tor );
     560    }
    556561}
    557562
     
    9991004}
    10001005
    1001 void
    1002 tr_torrentStart( tr_torrent * tor )
     1006static void
     1007torrentStart( tr_torrent * tor, int reloadProgress )
    10031008{
    10041009    tr_globalLock( tor->handle );
     
    10061011    if( !tor->isRunning )
    10071012    {
    1008         tr_torrentLoadResume( tor, TR_FR_PROGRESS, NULL );
     1013        if( reloadProgress )
     1014            tr_torrentLoadResume( tor, TR_FR_PROGRESS, NULL );
    10091015        tor->isRunning = 1;
    10101016        tr_verifyAdd( tor, checkAndStartCB );
     
    10121018
    10131019    tr_globalUnlock( tor->handle );
     1020}
     1021
     1022void
     1023tr_torrentStart( tr_torrent * tor )
     1024{
     1025    torrentStart( tor, TRUE );
    10141026}
    10151027
  • trunk/libtransmission/verify.c

    r5606 r5750  
    5757}
    5858
    59 static void
     59static int
    6060checkFile( tr_torrent       * tor,
    6161           tr_file_index_t    fileIndex,
     
    6363{
    6464    tr_piece_index_t i;
     65    int changed = FALSE;
    6566    int nofile;
    6667    struct stat sb;
     
    7980        else if( !tr_torrentIsPieceChecked( tor, i ) )
    8081        {
     82            const int wasComplete = tr_cpPieceIsComplete( tor->completion, i );
    8183            const tr_errno err = tr_ioTestPiece( tor, i );
    8284
     
    8486            {
    8587                tr_torrentSetHasPiece( tor, i, TRUE );
     88                if( !wasComplete )
     89                    changed = TRUE;
    8690            }
    8791            else
     
    9296                 * want to lose blocks in those incomplete pieces */
    9397
    94                 if( tr_cpPieceIsComplete( tor->completion, i ) )
     98                if( wasComplete ) {
    9599                    tr_torrentSetHasPiece( tor, i, FALSE );
     100                    changed = TRUE;
     101                }
    96102            }
    97103        }
     
    99105        tr_torrentSetPieceChecked( tor, i, TRUE );
    100106    }
     107
     108    return changed;
    101109}
    102110
     
    106114    for( ;; )
    107115    {
     116        int changed = 0;
    108117        tr_file_index_t i;
    109118        tr_torrent * tor;
     
    128137        tr_torinf( tor, _( "Verifying torrent" ) );
    129138        for( i=0; i<tor->info.fileCount && !stopCurrent; ++i )
    130             checkFile( tor, i, &stopCurrent );
     139            changed |= checkFile( tor, i, &stopCurrent );
    131140
    132141        tor->verifyState = TR_VERIFY_NONE;
     
    134143        if( !stopCurrent )
    135144        {
    136             tr_torrentSaveResume( tor );
     145            if( changed )
     146                tr_torrentSaveResume( tor );
    137147            fireCheckDone( tor, currentNode.verify_done_cb );
    138148        }
Note: See TracChangeset for help on using the changeset viewer.