Changeset 6421


Ignore:
Timestamp:
Jul 31, 2008, 1:06:59 PM (13 years ago)
Author:
charles
Message:

#1126: crash on quit

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/session.c

    r6403 r6421  
    498498
    499499    tr_sharedShuttingDown( h->shared );
    500     tr_trackerShuttingDown( h );
    501500    tr_rpcClose( &h->rpcServer );
    502501
     
    544543        tr_wait( 100 );
    545544
     545    tr_trackerSessionClose( h );
    546546    tr_list_free( &h->blocklists, (TrListForeachFunc)_tr_blocklistFree );
    547547    tr_webClose( &h->web );
  • trunk/libtransmission/tracker.c

    r6412 r6421  
    662662struct tr_tracker_handle
    663663{
    664     unsigned int isShuttingDown : 1;
    665664    int runningCount;
    666665    tr_timer * pulseTimer;
     
    681680
    682681void
    683 tr_trackerShuttingDown( tr_session * session )
    684 {
    685     if( session->tracker )
    686         session->tracker->isShuttingDown = 1;
    687 }
    688 
    689 static int
    690 maybeFreeGlobals( tr_session * session )
    691 {
    692     int globalsExist = session->tracker != NULL;
    693 
    694     if( globalsExist
    695         && ( session->tracker->runningCount < 1 )
    696         && ( session->torrentList== NULL ) )
     682tr_trackerSessionClose( tr_session * session )
     683{
     684    if( session && session->tracker )
    697685    {
    698686        dbgmsg( NULL, "freeing tracker timer" );
     
    700688        tr_free( session->tracker );
    701689        session->tracker = NULL;
    702         globalsExist = FALSE;
    703     }
    704 
    705     return globalsExist;
     690    }
    706691}
    707692
     
    804789        dbgmsg( NULL, "tracker pulse after upkeep... %d running", th->runningCount );
    805790
    806     return maybeFreeGlobals( session );
     791    /* free the tracker manager if no torrents are left */
     792    if(    ( session->tracker )
     793        && ( session->tracker->runningCount < 1 )
     794        && ( session->torrentList == NULL ) )
     795    {
     796        tr_trackerSessionClose( session );
     797    }
     798
     799    /* if there are still running torrents (as indicated by
     800     * the existence of the tracker manager) then keep the
     801     * trackerPulse() timer alive */
     802    return session->tracker != NULL;
    807803}
    808804
  • trunk/libtransmission/tracker.h

    r6042 r6421  
    2828void  tr_trackerFree ( tr_tracker * );
    2929
    30 void  tr_trackerShuttingDown( tr_handle * );
     30void  tr_trackerSessionClose( tr_handle * );
    3131
    3232/**
Note: See TracChangeset for help on using the changeset viewer.