Changeset 3783


Ignore:
Timestamp:
Nov 10, 2007, 3:13:31 PM (15 years ago)
Author:
charles
Message:

backport the rest of the "router death" fixes.

Location:
branches/0.9x
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.9x/NEWS

    r3723 r3783  
    11NEWS file for Transmission <http://transmission.m0k.org/>
     2
     30.93 (2007/xx/yy)
     4- All Platforms:
     5   + Fix "router death" bug that impaired internet use by
     6     cycling through too many peer connections too quickly
     7   + Fix bug that could cause good peer connections to be lost
     8   + Tweak our request queue code to improve download speeds
    29
    3100.92 (2007/11/05)
  • branches/0.9x/libtransmission/peer-mgr.c

    r3780 r3783  
    916916    if( !ok || !t || !t->isRunning )
    917917    {
     918        if( t ) {
     919            struct peer_atom * atom = getExistingAtom( t, addr );
     920            if( atom )
     921                ++atom->numFails;
     922        }
     923
    918924        tr_peerIoFree( io );
    919925    }
     
    15901596
    15911597static int
    1592 compareAtomByTime( const void * va, const void * vb )
     1598compareCandidates( const void * va, const void * vb )
    15931599{
    15941600    const struct peer_atom * a = * (const struct peer_atom**) va;
    15951601    const struct peer_atom * b = * (const struct peer_atom**) vb;
    1596     if( a->time < b->time ) return -1;
    1597     if( a->time > b->time ) return 1;
     1602    int i;
     1603
     1604    if(( i = tr_compareUint16( a->numFails, b->numFails )))
     1605        return i;
     1606
     1607    if( a->time != b->time )
     1608        return a->time < b->time ? -1 : 1;
     1609
    15981610    return 0;
    15991611}
     
    16391651        }
    16401652
     1653        /* we're wasting our time trying to connect to this bozo. */
     1654        if( atom->numFails > 10 ) {
     1655            tordbg( t, "RECONNECT peer %d (%s) gives us nothing but failure.",
     1656                    i, tr_peerIoAddrStr(&atom->addr,atom->port) );
     1657            continue;
     1658        }
     1659
    16411660        /* if we used this peer recently, give someone else a turn */
    1642         minWait = 60; /* one minute */
    1643         maxWait = (60 * 10); /* ten minutes */
    1644         wait = atom->numFails * 15; /* add 15 secs to the wait interval for each consecutive failure*/
     1661        minWait = 10; /* ten seconds */
     1662        maxWait = (60 * 20); /* twenty minutes */
     1663        wait = atom->numFails * 30; /* add 15 secs to the wait interval for each consecutive failure*/
    16451664        if( wait < minWait ) wait = minWait;
    16461665        if( wait > maxWait ) wait = maxWait;
     
    16541673    }
    16551674
    1656     qsort( ret, retCount, sizeof(struct peer_atom*), compareAtomByTime );
     1675    qsort( ret, retCount, sizeof(struct peer_atom*), compareCandidates );
    16571676    *setmeSize = retCount;
    16581677    return ret;
Note: See TracChangeset for help on using the changeset viewer.