Changeset 10664


Ignore:
Timestamp:
May 19, 2010, 7:02:25 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2929 "persistent tracker error messages in main window" -- experimental fix

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r10654 r10664  
    582582***/
    583583
    584 static const tr_tracker_event emptyEvent = { 0, NULL, NULL, 0, 0 };
     584static const tr_tracker_event emptyEvent = { 0, NULL, NULL, NULL, 0, 0 };
    585585
    586586static void
     
    593593        event.messageType = type;
    594594        event.text = msg;
     595        event.tracker = tier->currentTracker ? tier->currentTracker->announce : NULL;
    595596        tr_publisherPublish( &tiers->publisher, tier, &event );
    596597    }
  • trunk/libtransmission/announcer.h

    r10500 r10664  
    4444
    4545    /* for TR_TRACKER_WARNING and TR_TRACKER_ERROR */
    46     const char *  text;
     46    const char * text;
     47    const char * tracker;
    4748
    4849    /* for TR_TRACKER_PEERS */
  • trunk/libtransmission/torrent.c

    r10663 r10664  
    348348    va_start( ap, fmt );
    349349    tor->error = TR_STAT_LOCAL_ERROR;
     350    tor->errorTracker[0] = '\0';
    350351    evutil_vsnprintf( tor->errorString, sizeof( tor->errorString ), fmt, ap );
    351352    va_end( ap );
     353}
     354
     355static void
     356tr_torrentClearError( tr_torrent * tor )
     357{
     358    assert( tr_isTorrent( tor ) );
     359
     360    tor->error = TR_STAT_OK;
     361    tor->errorString[0] = '\0';
     362    tor->errorTracker[0] = '\0';
    352363}
    353364
     
    387398            tr_torerr( tor, _( "Tracker warning: \"%s\"" ), event->text );
    388399            tor->error = TR_STAT_TRACKER_WARNING;
     400            tr_strlcpy( tor->errorTracker, event->tracker, sizeof( tor->errorTracker ) );
    389401            tr_strlcpy( tor->errorString, event->text, sizeof( tor->errorString ) );
    390402            break;
     
    393405            tr_torerr( tor, _( "Tracker error: \"%s\"" ), event->text );
    394406            tor->error = TR_STAT_TRACKER_ERROR;
     407            tr_strlcpy( tor->errorTracker, event->tracker, sizeof( tor->errorTracker ) );
    395408            tr_strlcpy( tor->errorString, event->text, sizeof( tor->errorString ) );
    396409            break;
     
    398411        case TR_TRACKER_ERROR_CLEAR:
    399412            if( tor->error != TR_STAT_LOCAL_ERROR )
    400             {
    401                 tor->error = TR_STAT_OK;
    402                 tor->errorString[0] = '\0';
    403             }
     413                tr_torrentClearError( tor );
    404414            break;
    405415    }
     
    13641374        const time_t now = tr_time( );
    13651375        tor->isRunning = TRUE;
    1366         tor->error = TR_STAT_OK;
    1367         tor->errorString[0] = '\0';
    13681376        tor->completeness = tr_cpGetStatus( &tor->completion );
    13691377        tor->startDate = tor->anyDate = now;
     1378        tr_torrentClearError( tor );
    13701379
    13711380        tr_torrentResetTransferStats( tor );
     
    22102219        /* cleanup */
    22112220        tr_bencFree( &metainfo );
     2221
     2222        /* if we had a tracker-related error on this torrent,
     2223         * and that tracker's been removed,
     2224         * then clear the error */
     2225        if(    ( tor->error == TR_STAT_TRACKER_WARNING )
     2226            || ( tor->error == TR_STAT_TRACKER_ERROR ) )
     2227        {
     2228            tr_bool clear = TRUE;
     2229
     2230            for( i=0; clear && i<trackerCount; ++i )
     2231                if( !strcmp( trackers[i].announce, tor->errorTracker ) )
     2232                    clear = FALSE;
     2233
     2234            if( clear )
     2235                tr_torrentClearError( tor );
     2236        }
    22122237
    22132238        /* tell the announcer to reload this torrent's tracker list */
  • trunk/libtransmission/torrent.h

    r10663 r10664  
    142142    tr_stat_errtype          error;
    143143    char                     errorString[128];
     144    char                     errorTracker[128];
    144145
    145146    uint8_t                  obfuscatedHash[SHA_DIGEST_LENGTH];
Note: See TracChangeset for help on using the changeset viewer.