Changeset 3284


Ignore:
Timestamp:
Oct 4, 2007, 7:58:30 PM (13 years ago)
Author:
charles
Message:

Simplify the tracker/pause/close/recheck/start code.

Location:
trunk/libtransmission
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fastresume.c

    r3105 r3284  
    279279    if( TRUE ) /* FR_ID_RUN */
    280280    {
    281         const int run = tor->runStatusToSaveIsSet
    282             ? tor->runStatusToSave
    283             : tor->runStatus;
    284         const char is_running = (run == TR_RUN_RUNNING) ? 't' : 'f';
     281        const char is_running = tor->isRunning ? 't' : 'f';
    285282        fastResumeWriteData( FR_ID_RUN, &is_running, 1, 1, file );
    286283    }
     
    592589                        return ret;
    593590                    }
    594                     tor->runStatus = ch=='f' ? TR_RUN_STOPPED : TR_RUN_RUNNING;
     591                    tor->isRunning = ch=='t';
    595592                    ret |= TR_FR_RUN;
    596593                    continue;
  • trunk/libtransmission/inout.c

    r3172 r3284  
    287287    tr_torrent * torrent;
    288288    tr_recheck_done_cb recheck_done_cb;
    289     run_status_t status_when_done;
    290289};
    291290
    292291static void
    293292fireCheckDone( tr_torrent          * torrent,
    294                tr_recheck_done_cb    recheck_done_cb,
    295                run_status_t          status_when_done )
    296 {
    297     torrent->runStatus = status_when_done;
    298     (*recheck_done_cb)( torrent );
     293               tr_recheck_done_cb    recheck_done_cb )
     294{
     295    if( recheck_done_cb != NULL )
     296        (*recheck_done_cb)( torrent );
    299297}
    300298
     
    325323
    326324        tr_lockLock( getRecheckLock( ) );
     325        stopCurrent = FALSE;
    327326        node = (struct recheck_node*) recheckList ? recheckList->data : NULL;
    328         if( node == NULL )
     327        if( node == NULL ) {
     328            currentNode.torrent = NULL;
    329329            break;
     330        }
    330331
    331332        currentNode = *node;
     
    336337
    337338        if( tor->uncheckedPieces == NULL ) {
    338             fireCheckDone( tor, currentNode.recheck_done_cb, currentNode.status_when_done );
     339            tor->recheckState = TR_RECHECK_NONE;
     340            fireCheckDone( tor, currentNode.recheck_done_cb );
    339341            continue;
    340342        }
    341343
    342         tor->runStatus = TR_RUN_CHECKING;
     344        tor->recheckState = TR_RECHECK_NOW;
    343345
    344346        /* remove the unchecked pieces from completion... */
     
    358360        }
    359361
     362        tor->recheckState = TR_RECHECK_NONE;
     363
    360364        if( !stopCurrent )
    361365        {
    362366            tr_bitfieldFree( tor->uncheckedPieces );
    363367            tor->uncheckedPieces = NULL;
     368            tr_fastResumeSave( tor );
     369            fireCheckDone( tor, currentNode.recheck_done_cb );
    364370        }
    365         stopCurrent = FALSE;
    366         tr_fastResumeSave( tor );
    367         fireCheckDone( tor, currentNode.recheck_done_cb, currentNode.status_when_done );
    368371    }
    369372
     
    374377void
    375378tr_ioRecheckAdd( tr_torrent          * tor,
    376                  tr_recheck_done_cb    recheck_done_cb,
    377                  run_status_t          status_when_done )
     379                 tr_recheck_done_cb    recheck_done_cb )
    378380{
    379381    struct recheck_node * node;
     
    381383    node->torrent = tor;
    382384    node->recheck_done_cb = recheck_done_cb;
    383     node->status_when_done = status_when_done;
    384385
    385386    tr_lockLock( getRecheckLock( ) );
    386387    tr_list_append( &recheckList, node );
    387     tor->runStatus = TR_RUN_CHECKING_WAIT;
     388    tor->recheckState = TR_RECHECK_WAIT;
    388389    if( recheckThread == NULL )
    389390        recheckThread = tr_threadNew( recheckThreadFunc, NULL, "recheckThreadFunc" );
     
    402403tr_ioRecheckRemove( tr_torrent * tor )
    403404{
    404     if( tor == currentNode.torrent )
     405    tr_lockLock( getRecheckLock( ) );
     406
     407    if( tor == currentNode.torrent ) {
    405408        stopCurrent = TRUE;
    406     else {
     409        while( stopCurrent )
     410            tr_wait( 50 );
     411    } else {
    407412        struct recheck_node tmp;
    408413        tmp.torrent = tor;
    409414        struct recheck_node * node = tr_list_remove( &recheckList, &tmp, compareRecheckByTorrent );
    410         if( node != NULL ) {
    411             fireCheckDone( tor, node->recheck_done_cb, node->status_when_done );
    412             tr_free( node );
    413         }
     415        tr_free( node );
     416        tor->recheckState = TR_RECHECK_NONE;
    414417    }
    415 }
     418
     419    tr_lockUnlock( getRecheckLock( ) );
     420}
  • trunk/libtransmission/inout.h

    r3105 r3284  
    5454
    5555void tr_ioRecheckAdd( tr_torrent          * tor,
    56                       tr_recheck_done_cb    recheck_done_cb,
    57                       run_status_t          status_when_done );
     56                      tr_recheck_done_cb    recheck_done_cb );
    5857
    5958void tr_ioRecheckRemove( tr_torrent * tor );
  • trunk/libtransmission/internal.h

    r3254 r3284  
    9393typedef enum
    9494{
    95     TR_RUN_CHECKING_WAIT      = (1<<0), /* waiting to be checked */
    96     TR_RUN_CHECKING           = (1<<1), /* checking files' checksums */
    97     TR_RUN_RUNNING            = (1<<2), /* seeding or leeching */
    98     TR_RUN_STOPPING           = (1<<3), /* waiting for acknowledgment from tracker */
    99     TR_RUN_STOPPED            = (1<<4)  /* stopped */
     95   TR_RECHECK_NONE,
     96   TR_RECHECK_WAIT,
     97   TR_RECHECK_NOW
    10098}
    101 run_status_t;
     99tr_recheck_state;
    102100
    103101#define TR_ID_LEN  20
     
    137135
    138136    struct tr_bitfield       * uncheckedPieces;
    139     run_status_t               runStatus;
    140     run_status_t               runStatusToSave;
    141137    cp_status_t                cpStatus;
    142138
     
    158154    void                     * status_func_user_data;
    159155
    160     unsigned int               runStatusToSaveIsSet : 1;
    161156    unsigned int               pexDisabled : 1;
    162     unsigned int               doStopAfterHashCheck : 1;
    163157    unsigned int               statCur : 1;
     158    unsigned int               isRunning : 1;
     159
     160    tr_recheck_state           recheckState;
    164161
    165162    tr_stat                    stats[2];
  • trunk/libtransmission/torrent.c

    r3268 r3284  
    176176            tor->errorString[0] = '\0';
    177177            break;
    178 
    179         case TR_TRACKER_STOPPED:
    180             //assert( tor->runStatus == TR_RUN_STOPPING );
    181             tor->runStatus = TR_RUN_STOPPED;
    182             break;
    183178    }
    184179}
     
    260255
    261256static void
    262 tr_torrentStartImpl( tr_torrent * tor )
    263 {
    264     assert( tor != NULL );
    265     assert( tor->runStatus == TR_RUN_RUNNING );
    266 
    267     *tor->errorString = '\0';
    268     tr_torrentResetTransferStats( tor );
    269     tr_torrentRecheckCompleteness( tor );
    270     tor->startDate = tr_date();
    271     tr_trackerStart( tor->tracker );
    272     tr_peerMgrStartTorrent( tor->handle->peerMgr, tor->info.hash );
    273 }
    274 
    275 static void
    276 recheckDoneCB( tr_torrent * tor )
    277 {
    278     tr_torrentRecheckCompleteness( tor );
    279 
    280     if( tor->doStopAfterHashCheck ) {
    281         tor->doStopAfterHashCheck = 0;
    282         tr_torrentStop( tor );
    283     }
    284 
    285     if( tor->runStatus == TR_RUN_RUNNING )
    286         tr_torrentStartImpl( tor );
    287 }
    288 
    289 static void
    290257torrentRealInit( tr_handle  * h,
    291258                 tr_torrent * tor,
     
    293260                 int          flags )
    294261{
     262    int doStart;
    295263    uint64_t loaded;
    296264    uint64_t t;
     
    306274    tor->handle   = h;
    307275    tor->pexDisabled = 0;
    308 
    309     tor->runStatusToSaveIsSet = FALSE;
    310276
    311277    /**
     
    381347       if that's not found, default to RUNNING */
    382348    if( flags & TR_FLAG_PAUSED )
    383         tor->runStatus = TR_RUN_STOPPED;
    384     else if( !(loaded & TR_FR_RUN ) )
    385         tor->runStatus = TR_RUN_RUNNING;
     349        doStart = 0;
     350    else if( loaded & TR_FR_RUN )
     351        doStart = tor->isRunning;
     352    else
     353        doStart = 1;
     354    tor->isRunning = 0;
    386355
    387356    if( tr_bitfieldIsEmpty( uncheckedPieces ) )
     
    410379    tr_globalUnlock( h );
    411380
    412     tr_ioRecheckAdd( tor, recheckDoneCB, tor->runStatus );
     381    if( doStart )
     382        tr_torrentStart( tor );
    413383}
    414384
     
    679649    assert( tor != NULL );
    680650    assert( disable==0 || disable==1 );
    681     //assert( tor->runStatus != TR_RUN_RUNNING );
    682651
    683652    /* pex is ALWAYS disabled for private torrents */
     
    691660tr_manualUpdate( tr_torrent * tor )
    692661{
    693     if( tor->runStatus == TR_RUN_RUNNING )
    694     tr_trackerReannounce( tor->tracker );
     662    if( tor->isRunning )
     663        tr_trackerReannounce( tor->tracker );
    695664}
    696665int
     
    698667{
    699668    return ( tor != NULL )
    700         && ( tor->runStatus == TR_RUN_RUNNING )
     669        && ( tor->isRunning )
    701670        && ( tr_trackerCanManualAnnounce( tor->tracker ) );
    702671}
     
    733702    s->leftUntilDone = tr_cpLeftUntilDone( tor->completion );
    734703
    735     switch( tor->runStatus ) {
    736         case TR_RUN_CHECKING_WAIT: s->status = TR_STATUS_CHECK_WAIT; break;
    737         case TR_RUN_CHECKING: s->status = TR_STATUS_CHECK; break;
    738         case TR_RUN_STOPPING: s->status = TR_STATUS_STOPPING; break;
    739         case TR_RUN_STOPPED: s->status = TR_STATUS_STOPPED; break;
    740         case TR_RUN_RUNNING: switch( tor->cpStatus ) {
    741             case TR_CP_INCOMPLETE: s->status = TR_STATUS_DOWNLOAD; break;
    742             case TR_CP_DONE: s->status = TR_STATUS_DONE; break;
    743             case TR_CP_COMPLETE: s->status = TR_STATUS_SEED; break;
    744         }
    745     }
     704    if( tor->recheckState == TR_RECHECK_NOW )
     705        s->status = TR_STATUS_CHECK;
     706    else if( tor->recheckState == TR_RECHECK_WAIT )
     707        s->status = TR_STATUS_CHECK_WAIT;
     708    else if( !tor->isRunning )
     709        s->status = TR_STATUS_STOPPED;
     710    else if( tor->cpStatus == TR_CP_INCOMPLETE )
     711        s->status = TR_STATUS_DOWNLOAD;
     712    else if( tor->cpStatus == TR_CP_DONE )
     713        s->status = TR_STATUS_DONE;
     714    else
     715        s->status = TR_STATUS_SEED;
    746716
    747717    s->recheckProgress = (tor->uncheckedPieces == NULL)
     
    755725       download rate even tough we are not downloading. So we
    756726       force it to zero not to confuse the user. */
    757     s->rateDownload = tor->runStatus==TR_RUN_RUNNING
     727    s->rateDownload = tor->isRunning
    758728        ? tr_rcRate( tor->download )
    759729        : 0.0;
     
    971941}
    972942
    973 void tr_torrentRecheck( tr_torrent * tor )
    974 {
    975     if( !tor->uncheckedPieces )
    976         tor->uncheckedPieces = tr_bitfieldNew( tor->info.pieceCount );
    977     tr_bitfieldAddRange( tor->uncheckedPieces, 0, tor->info.pieceCount );
    978 
    979     tr_ioRecheckAdd( tor, recheckDoneCB, tor->runStatus );
    980 }
    981 
    982943/***
    983944****
    984945***/
    985946
    986 void
    987 tr_torrentStart( tr_torrent * tor )
    988 {
    989     tr_ioRecheckAdd( tor, recheckDoneCB, TR_RUN_RUNNING );
    990 }
    991 
    992947static void
    993 tr_torrentFree( tr_torrent * tor )
     948freeTorrent( tr_torrent * tor )
    994949{
    995950    tr_torrent * t;
     
    998953
    999954    assert( tor != NULL );
    1000     assert( tor->runStatus == TR_RUN_STOPPED );
     955    assert( !tor->isRunning );
    1001956
    1002957    tr_globalLock( h );
     
    1037992}
    1038993
    1039 static int
    1040 freeWhenStopped( void * vtor )
     994enum
     995{
     996    AFTER_RECHECK_NONE,
     997    AFTER_RECHECK_START,
     998    AFTER_RECHECK_STOP,
     999    AFTER_RECHECK_CLOSE
     1000};
     1001
     1002static void
     1003checkAndStartCB( tr_torrent * tor )
     1004{
     1005    tr_globalLock( tor->handle );
     1006
     1007    tr_torrentRecheckCompleteness( tor );
     1008
     1009    tor->isRunning  = 1;
     1010    *tor->errorString = '\0';
     1011    tr_torrentResetTransferStats( tor );
     1012    tr_torrentRecheckCompleteness( tor );
     1013    tor->startDate = tr_date( );
     1014    tor->isRunning = 1;
     1015    tr_trackerStart( tor->tracker );
     1016    tr_peerMgrStartTorrent( tor->handle->peerMgr, tor->info.hash );
     1017
     1018    tr_globalUnlock( tor->handle );
     1019}
     1020
     1021static void
     1022checkAndStart( void * vtor )
    10411023{
    10421024    tr_torrent * tor = vtor;
    1043 
    1044     if( tor->runStatus != TR_RUN_STOPPED ) /* keep waiting */
    1045         return TRUE;
    1046 
    1047     tr_torrentFree( tor );
    1048     return FALSE;
     1025    tr_globalLock( tor->handle );
     1026
     1027    if( !tor->isRunning )
     1028    {
     1029        tor->isRunning = 1;
     1030        tr_ioRecheckAdd( tor, checkAndStartCB );
     1031    }
     1032
     1033    tr_globalUnlock( tor->handle );
     1034}
     1035
     1036void
     1037tr_torrentRecheck( tr_torrent * tor )
     1038{
     1039    if( !tor->uncheckedPieces )
     1040        tor->uncheckedPieces = tr_bitfieldNew( tor->info.pieceCount );
     1041    tr_bitfieldAddRange( tor->uncheckedPieces, 0, tor->info.pieceCount );
     1042
     1043    tr_ioRecheckAdd( tor, NULL );
     1044}
     1045   
     1046void
     1047tr_torrentStart( tr_torrent * tor )
     1048{
     1049    tr_globalLock( tor->handle );
     1050
     1051    tr_runInEventThread( tor->handle, checkAndStart, tor );
     1052
     1053    tr_globalUnlock( tor->handle );
     1054}
     1055
     1056
     1057static void
     1058stopTorrent( void * vtor )
     1059{
     1060    tr_torrent * tor = vtor;
     1061    tr_ioRecheckRemove( tor );
     1062    tr_peerMgrStopTorrent( tor->handle->peerMgr, tor->info.hash );
     1063    tr_trackerStop( tor->tracker );
     1064    tr_ioClose( tor );
    10491065}
    10501066
     
    10541070    tr_globalLock( tor->handle );
    10551071
    1056     switch( tor->runStatus )
    1057     {
    1058         case TR_RUN_CHECKING_WAIT:
    1059         case TR_RUN_CHECKING:
    1060             tor->doStopAfterHashCheck = 1;
    1061             tr_ioRecheckRemove( tor );
    1062             break;
    1063 
    1064         case TR_RUN_RUNNING:
    1065             saveFastResumeNow( tor );
    1066             tr_peerMgrStopTorrent( tor->handle->peerMgr, tor->info.hash );
    1067             tor->runStatus = TR_RUN_STOPPING;
    1068             tr_trackerStop( tor->tracker );
    1069             tr_ioClose( tor );
    1070             break;
    1071 
    1072         case TR_RUN_STOPPING:
    1073         case TR_RUN_STOPPED:
    1074             break;
    1075     }
     1072    saveFastResumeNow( tor );
     1073    tor->isRunning = 0;
     1074    tr_runInEventThread( tor->handle, stopTorrent, tor );
    10761075
    10771076    tr_globalUnlock( tor->handle );
    10781077}
    10791078
     1079static void
     1080closeTorrent( void * vtor )
     1081{
     1082    tr_torrent * tor = vtor;
     1083    saveFastResumeNow( tor );
     1084    tor->isRunning = 0;
     1085    stopTorrent( tor );
     1086    freeTorrent( tor );
     1087}
     1088
    10801089void
    10811090tr_torrentClose( tr_torrent * tor )
     
    10831092    tr_globalLock( tor->handle );
    10841093
    1085     tor->runStatusToSave = tor->runStatus;
    1086     tor->runStatusToSaveIsSet = TRUE;
    1087     tr_torrentStop( tor );
    1088     tr_timerNew( tor->handle, freeWhenStopped, tor, 250 );
     1094    tr_runInEventThread( tor->handle, closeTorrent, tor );
    10891095
    10901096    tr_globalUnlock( tor->handle );
     
    11991205}
    12001206
    1201 
    12021207tr_priority_t*
    12031208tr_torrentGetFilePriorities( const tr_torrent * tor )
  • trunk/libtransmission/tracker.c

    r3242 r3284  
    108108    uint8_t hash[SHA_DIGEST_LENGTH];
    109109    char escaped[SHA_DIGEST_LENGTH * 3 + 1];
     110    char * name;
    110111
    111112    /* corresponds to the peer_id sent as a tracker request parameter.
     
    135136    tr_timer * reannounceTimer;
    136137
    137     struct evhttp_request * httpReq;
    138 
    139     tr_torrent * torrent;
     138    unsigned int isRunning : 1;
    140139}
    141140Torrent;
     
    226225    event.peerCount = count;
    227226    event.peerCompact = peers;
    228     tr_inf( "Torrent \"%s\" got %d new peers", tor->torrent->info.name, count );
    229     tr_publisherPublish( tor->publisher, tor, &event );
    230 }
    231 
    232 static void
    233 publishStopped( Torrent * tor )
    234 {
    235     tr_tracker_event_t event = emptyEvent;
    236     event.hash = tor->hash;
    237     event.messageType = TR_TRACKER_STOPPED;
     227    tr_inf( "Torrent \"%s\" got %d new peers", tor->name, count );
    238228    tr_publisherPublish( tor->publisher, tor, &event );
    239229}
     
    372362    tr_timerFree( &tor->reannounceTimer );
    373363    tr_publisherFree( &tor->publisher );
     364    tr_free( tor->name );
    374365    tr_free( tor->trackerID );
    375366    tr_free( tor->lastRequest );
    376     if( tor->httpReq != NULL )
    377         evhttp_request_free( tor->httpReq );
    378367    tr_free( tor );
    379368
     
    424413    tor->publisher = tr_publisherNew( );
    425414    tor->tracker = t;
    426     tor->torrent = torrent;
     415    /*tor->torrent = torrent;*/
    427416    tor->timesDownloaded = -1;
    428417    tor->seeders = -1;
    429418    tor->leechers = -1;
    430419    tor->manualAnnounceAllowedAt = ~0;
     420    tor->name = tr_strdup( torrent->info.name );
    431421    memcpy( tor->hash, torrent->info.hash, SHA_DIGEST_LENGTH );
    432422    escape( tor->escaped, torrent->info.hash, SHA_DIGEST_LENGTH );
     
    627617                tr_dbg( "Torrent '%s' scrape successful."
    628618                        "  Rescraping in %d seconds",
    629                         tor->torrent->info.name, t->scrapeIntervalMsec/1000 );
     619                        tor->name, t->scrapeIntervalMsec/1000 );
    630620            }
    631621
     
    754744
    755745static char*
    756 buildTrackerRequestURI( const Torrent * tor, const char * eventName )
    757 {
    758     const tr_torrent * torrent = tor->torrent;
     746buildTrackerRequestURI( const Torrent     * tor,
     747                        const tr_torrent  * torrent,
     748                        const char        * eventName )
     749{
    759750    const int stopping = !strcmp( eventName, "stopped" );
    760751    const int numwant = stopping ? 0 : NUMWANT;
     
    859850
    860851    tr_inf( "Torrent \"%s\" tracker response: %s",
    861             tor->torrent->info.name,
     852            tor->name,
    862853            ( req ? req->response_code_line : "(null)") );
    863854
     
    932923                tor->tracker->primaryAddress,
    933924                tor->lastRequest,
    934                 tor->torrent->info.name );
     925                tor->name );
    935926
    936927        reannounceInterval = 30 * 1000;
     
    943934    }
    944935
    945     tor->httpReq = NULL;
    946 
    947     if( isStopped )
    948         publishStopped( tor );
    949     else if( reannounceInterval > 0 ) {
     936    if( !isStopped && reannounceInterval>0 ) {
    950937        tr_dbg( "torrent '%s' reannouncing in %d seconds",
    951                 tor->torrent->info.name, (reannounceInterval/1000) );
     938                tor->name, (reannounceInterval/1000) );
    952939        tr_timerFree( &tor->reannounceTimer );
    953940        tor->reannounceTimer = tr_timerNew( tor->tracker->handle, onReannounceNow, tor, reannounceInterval );
     
    958945
    959946static int
    960 sendTrackerRequest( void * vtor, const char * eventName )
    961 {
    962     Torrent * tor = (Torrent *) vtor;
    963     const tr_tracker_info * address = getCurrentAddress( tor->tracker );
    964     char * uri = buildTrackerRequestURI( tor, eventName );
     947sendTrackerRequest( void * vt, const char * eventName )
     948{
     949    Torrent * t = (Torrent *) vt;
     950    const tr_tracker_info * address = getCurrentAddress( t->tracker );
     951    char * uri;
    965952    struct evhttp_connection * evcon = NULL;
     953    const tr_torrent * tor;
     954
     955    tor = tr_torrentFindFromHash( t->tracker->handle, t->hash );
     956    if( tor == NULL )
     957        return FALSE;   
     958
     959    uri = buildTrackerRequestURI( t, tor, eventName );
    966960
    967961    tr_inf( "Torrent \"%s\" sending '%s' to tracker %s:%d: %s",
    968             tor->torrent->info.name,
     962            t->name,
    969963            (eventName ? eventName : "periodic announce"),
    970964            address->address, address->port,
     
    972966
    973967    /* kill any pending requests */
    974     tr_timerFree( &tor->reannounceTimer );
    975 
    976     evcon = getConnection( tor->tracker, address->address, address->port );
     968    tr_timerFree( &t->reannounceTimer );
     969
     970    evcon = getConnection( t->tracker, address->address, address->port );
    977971    if ( !evcon ) {
    978972        tr_err( "Can't make a connection to %s:%d", address->address, address->port );
    979973        tr_free( uri );
    980974    } else {
    981         tr_free( tor->lastRequest );
    982         tor->lastRequest = tr_strdup( eventName );
     975        struct evhttp_request * httpReq;
     976        tr_free( t->lastRequest );
     977        t->lastRequest = tr_strdup( eventName );
    983978        evhttp_connection_set_timeout( evcon, REQ_TIMEOUT_INTERVAL_SEC );
    984         tor->httpReq = evhttp_request_new( onTrackerResponse, tor );
    985         addCommonHeaders( tor->tracker, tor->httpReq );
    986         tr_evhttp_make_request( tor->tracker->handle, evcon,
    987                                 tor->httpReq, EVHTTP_REQ_GET, uri );
     979        httpReq = evhttp_request_new( onTrackerResponse, t );
     980        addCommonHeaders( t->tracker, httpReq );
     981        tr_evhttp_make_request( t->tracker->handle, evcon,
     982                                httpReq, EVHTTP_REQ_GET, uri );
    988983    }
    989984
     
    10551050    tr_peerIdNew( tor->peer_id, sizeof(tor->peer_id) );
    10561051
    1057     if( !tor->reannounceTimer && !tor->httpReq )
     1052    if( !tor->reannounceTimer && !tor->isRunning )
     1053    {
     1054        tor->isRunning = 1;
    10581055        sendTrackerRequest( tor, "started" );
     1056    }
    10591057}
    10601058
     
    10741072tr_trackerStop( Torrent * tor )
    10751073{
    1076     sendTrackerRequest( tor, "stopped" );
     1074    if( tor->isRunning )
     1075    {
     1076        tor->isRunning = 0;
     1077        sendTrackerRequest( tor, "stopped" );
     1078    }
    10771079}
    10781080
  • trunk/libtransmission/tracker.h

    r3167 r3284  
    3535    TR_TRACKER_ERROR,
    3636    TR_TRACKER_ERROR_CLEAR,
    37     TR_TRACKER_PEERS,
    38     TR_TRACKER_STOPPED
     37    TR_TRACKER_PEERS
    3938}
    4039TrackerEventType;
Note: See TracChangeset for help on using the changeset viewer.