Changeset 6042


Ignore:
Timestamp:
Jun 4, 2008, 11:46:32 PM (14 years ago)
Author:
charles
Message:

fix tracker crash caused by the new add/remove tracker code reported by BentMyWookie?

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r5934 r6042  
    116116
    117117static const tr_tracker_info *
    118 getCurrentAddressFromTorrent( const tr_tracker * t, const tr_torrent * tor )
    119 {
     118getCurrentAddressFromTorrent( tr_tracker * t, const tr_torrent * tor )
     119{
     120    /* user might have removed trackers,
     121     * so check to make sure our current index is in-bounds */
     122    if( t->trackerIndex >= tor->info.trackerCount )
     123        t->trackerIndex = 0;
     124
    120125    assert( t->trackerIndex >= 0 );
    121126    assert( t->trackerIndex < tor->info.trackerCount );
     
    124129   
    125130static const tr_tracker_info *
    126 getCurrentAddress( const tr_tracker * t )
     131getCurrentAddress( tr_tracker * t )
    127132{
    128133    const tr_torrent * torrent;
     
    133138
    134139static int
    135 trackerSupportsScrape( const tr_tracker * t, const tr_torrent * tor )
     140trackerSupportsScrape( tr_tracker * t, const tr_torrent * tor )
    136141{
    137142    const tr_tracker_info * info = getCurrentAddressFromTorrent( t, tor );
     
    555560
    556561static void
    557 buildTrackerRequestURI( const tr_tracker  * t,
     562buildTrackerRequestURI( tr_tracker        * t,
    558563                        const tr_torrent  * torrent,
    559564                        const char        * eventName,
     
    593598
    594599static struct tr_tracker_request*
    595 createRequest( tr_session * session, const tr_tracker * tracker, int reqtype )
     600createRequest( tr_session * session, tr_tracker * tracker, int reqtype )
    596601{
    597602    static const char* strings[] = { "started", "completed", "stopped", "", "err" };
     
    618623
    619624static struct tr_tracker_request*
    620 createScrape( tr_session * session, const tr_tracker * tracker )
     625createScrape( tr_session * session, tr_tracker * tracker )
    621626{
    622627    const tr_tracker_info * a = getCurrentAddress( tracker );
     
    727732
    728733static void
    729 enqueueScrape( tr_session * session, const tr_tracker * tracker )
     734enqueueScrape( tr_session * session, tr_tracker * tracker )
    730735{
    731736    struct tr_tracker_request * req;
     
    736741
    737742static void
    738 enqueueRequest( tr_session * session, const tr_tracker * tracker, int reqtype )
     743enqueueRequest( tr_session * session, tr_tracker * tracker, int reqtype )
    739744{
    740745    struct tr_tracker_request * req;
     
    900905
    901906const tr_tracker_info *
    902 tr_trackerGetAddress( const tr_tracker   * t )
     907tr_trackerGetAddress( tr_tracker   * t )
    903908{
    904909    return getCurrentAddress( t );
  • trunk/libtransmission/tracker.h

    r5911 r6042  
    6161tr_tracker_event;
    6262
    63 tr_publisher_tag  tr_trackerSubscribe       ( struct tr_tracker * tag,
    64                                               tr_delivery_func      func,
    65                                               void                * user );
     63tr_publisher_tag  tr_trackerSubscribe       ( struct tr_tracker      * tag,
     64                                              tr_delivery_func         func,
     65                                              void                   * user );
    6666
    67 void              tr_trackerUnsubscribe     ( struct tr_tracker * tracker,
    68                                               tr_publisher_tag      tag );
     67void              tr_trackerUnsubscribe     ( struct tr_tracker      * tracker,
     68                                              tr_publisher_tag         tag );
    6969
    7070/***
     
    8585void tr_trackerChangeMyPort                 ( struct tr_tracker * );
    8686
    87 const tr_tracker_info * tr_trackerGetAddress( const struct tr_tracker * );
     87const tr_tracker_info * tr_trackerGetAddress( struct tr_tracker * );
    8888
    8989int  tr_trackerCanManualAnnounce            ( const struct tr_tracker * );
Note: See TracChangeset for help on using the changeset viewer.