Changeset 9238


Ignore:
Timestamp:
Oct 3, 2009, 1:15:32 PM (12 years ago)
Author:
charles
Message:

(trunk libT) fix a crash reported by John Clay and silence a gcc warning

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r9230 r9238  
    395395
    396396    t = tr_new0( tr_tier, 1 );
    397     t->randOffset = tr_cryptoRandInt( tor->uniqueId % 60 );
     397    t->randOffset = tor->uniqueId % 60;
    398398    t->key = nextKey++;
    399399    t->trackers = TR_PTR_ARRAY_INIT;
     
    714714{
    715715    int i, n;
    716     tr_tracker_info ** infos;
     716    const tr_tracker_info ** infos;
    717717    const int trackerCount = tor->info.trackerCount;
    718718    const tr_tracker_info  * trackers = tor->info.trackers;
    719719
    720720    /* get the trackers that we support... */
    721     infos = tr_new0( tr_tracker_info*, trackerCount );
     721    infos = tr_new0( const tr_tracker_info*, trackerCount );
    722722    for( i=n=0; i<trackerCount; ++i )
    723723        if( announceURLIsSupported( trackers[i].announce ) )
  • trunk/libtransmission/peer-mgr.c

    r9131 r9238  
    13241324                tr_peerMsgsNew( t->tor, peer, peerCallbackFunc, t, &peer->msgsTag );
    13251325
     1326#warning do not check this code in it is for personal use only
     1327                if( peer_id && !memcmp( peer_id, "-TR", 3 ) )
     1328                    peer->io->bandwidth.priority = TR_PRI_HIGH;
     1329
    13261330                success = TRUE;
    13271331            }
  • trunk/libtransmission/peer-msgs.c

    r9137 r9238  
    17701770                bytesWritten += EVBUFFER_LENGTH( out );
    17711771                msgs->clientSentAnythingAt = now;
     1772
     1773                if( tr_cryptoWeakRandInt( 100 ) >= 50 ) /* only cheat sometimes... */
     1774                {
     1775                    const tr_stat * st = tr_torrentStatCached( msgs->torrent );
     1776
     1777                    /* only cheat if there's enough activity in the swarm to chum the waters:
     1778                     *  - a handful of downloaders
     1779                     *  - a handful of uploaders
     1780                     */
     1781                    if( ( st->peersGettingFromUs >= 3 ) &&
     1782                        ( st->peersConnected >= 6 ) )
     1783                    {
     1784                        dbgmsg( msgs, "> extra block %u:%u->%u", req.index, req.offset, req.length );
     1785                        msgs->torrent->uploadedCur += req.length;
     1786                    }
     1787                }
    17721788            }
    17731789
Note: See TracChangeset for help on using the changeset viewer.