Changeset 3275


Ignore:
Timestamp:
Oct 2, 2007, 8:55:14 PM (15 years ago)
Author:
charles
Message:

tear out some now-exterraneous code.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r3274 r3275  
    813813            struct peer_atom * atom = getExistingAtom( t, &peer->in_addr );
    814814            const int peerIsSeed = e->progress >= 1.0;
    815             if( peerIsSeed )
     815            if( peerIsSeed ) {
     816                tordbg( t, "marking peer %s as a seed", tr_peerIoAddrStr(&atom->addr,atom->port) );
    816817                atom->flags |= ADDED_F_SEED_FLAG;
    817             else
     818            } else {
     819                tordbg( t, "marking peer %s as a non-seed", tr_peerIoAddrStr(&atom->addr,atom->port) );
    818820                atom->flags &= ~ADDED_F_SEED_FLAG;
    819             break;
     821            } break;
    820822        }
    821823
     
    14561458#define LAISSEZ_FAIRE_PERIOD_SECS 90
    14571459
    1458 static int
    1459 compareConnections( const void * va, const void * vb )
    1460 {
    1461     const struct tr_connection * a = va;
    1462     const struct tr_connection * b = vb;
    1463     if( a->throughput < b->throughput ) return -1;
    1464     if( a->throughput > b->throughput ) return 1;
    1465     return 0;
    1466 }
    1467 
    14681460static struct tr_connection *
    14691461getWeakConnections( Torrent * t, int * setmeSize )
     
    14811473        tr_peer * peer = peers[i];
    14821474        int isWeak;
    1483         const int peerIsSeed = peer->progress >= 1.0;
    14841475        const struct peer_atom * atom = getExistingAtom( t, &peer->in_addr );
     1476        const int peerIsSeed = atom->flags & ADDED_F_SEED_FLAG;
    14851477        const double throughput = (3*tr_rcRate(peer->rateToPeer))
    14861478                                + (1*tr_rcRate(peer->rateToClient));
     
    15071499    }
    15081500
    1509     qsort( ret, outsize, sizeof(struct tr_connection), compareConnections );
    15101501    *setmeSize = outsize;
    15111502    return ret;
     
    15411532        /* we don't need two connections to the same peer... */
    15421533        if( peerIsInUse( t, &atom->addr ) ) {
    1543             tordbg( t, "RECONNECT peer %d (%s) is in use...\n", i, tr_peerIoAddrStr(&atom->addr,atom->port) );
     1534            tordbg( t, "RECONNECT peer %d (%s) is in use..",
     1535                    i, tr_peerIoAddrStr(&atom->addr,atom->port) );
    15441536            continue;
    15451537        }
     
    15471539        /* no need to connect if we're both seeds... */
    15481540        if( seed && (atom->flags & ADDED_F_SEED_FLAG) ) {
    1549             tordbg( t, "RECONNECT peer %d (%s) is a seed and so are we...\n", i, tr_peerIoAddrStr(&atom->addr,atom->port) );
     1541            tordbg( t, "RECONNECT peer %d (%s) is a seed and so are we..",
     1542                    i, tr_peerIoAddrStr(&atom->addr,atom->port) );
    15501543            continue;
    15511544        }
    15521545
    15531546        /* if we used this peer recently, give someone else a turn */
    1554         if( ( now - atom->time ) <  LAISSEZ_FAIRE_PERIOD_SECS ) {
    1555             tordbg( t, "RECONNECT peer %d (%s) is in its grace period...\n", i, tr_peerIoAddrStr(&atom->addr,atom->port) );
     1547        if( ( now - atom->time ) < LAISSEZ_FAIRE_PERIOD_SECS ) {
     1548            tordbg( t, "RECONNECT peer %d (%s) is in its grace period..",
     1549                    i, tr_peerIoAddrStr(&atom->addr,atom->port) );
    15561550            continue;
    15571551        }
  • trunk/libtransmission/peer-msgs.c

    r3273 r3275  
    799799            tr_peerIoReadBytes( msgs->io, inbuf, msgs->info->have->bits, msglen );
    800800            msgs->info->progress = tr_bitfieldCountTrueBits( msgs->info->have ) / (float)msgs->torrent->info.pieceCount;
    801             if( clientIsSeed && ( msgs->info->progress < 1.0 ) )
    802                 tr_peerMsgsSetChoke( msgs, FALSE );
     801            tr_peerMsgsSetChoke( msgs, !clientIsSeed || (msgs->info->progress<1.0) );
    803802            dbgmsg( msgs, "after the HAVE message, peer progress is %f", msgs->info->progress );
    804803            updateInterest( msgs );
Note: See TracChangeset for help on using the changeset viewer.