Ignore:
Timestamp:
Nov 17, 2007, 11:43:33 PM (15 years ago)
Author:
charles
Message:

Add "Status" column to tr_peer_stat.

File:
1 edited

Legend:

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

    r3825 r3861  
    3636#include "ratecontrol.h"
    3737#include "shared.h"
     38#include "trcompat.h" /* strlcpy */
    3839#include "trevent.h"
    3940#include "utils.h"
     
    14141415
    14151416        tr_netNtop( &peer->in_addr, stat->addr, sizeof(stat->addr) );
     1417        strlcpy( stat->client, (peer->client ? peer->client : ""), sizeof(stat->client) );
    14161418        stat->port             = peer->port;
    14171419        stat->from             = atom->from;
    1418         stat->client           = tr_strdup( peer->client ? peer->client : "" );
    14191420        stat->progress         = peer->progress;
    14201421        stat->isEncrypted      = tr_peerIoIsEncrypted( peer->io ) ? 1 : 0;
     
    14231424        stat->isDownloading    = stat->uploadToRate > 0.01;
    14241425        stat->isUploading      = stat->downloadFromRate > 0.01;
     1426        stat->status           = peer->status;
    14251427    }
    14261428
     
    14831485rechoke( Torrent * t )
    14841486{
    1485     int i, peerCount, size=0, unchoked=0;
     1487    int i, peerCount, size=0;
    14861488    const time_t fibrillationTime = time(NULL) - MIN_CHOKE_PERIOD_SEC;
    14871489    tr_peer ** peers = getConnectedPeers( t, &peerCount );
     
    15061508    qsort( choke, size, sizeof(struct ChokeData), compareChoke );
    15071509
    1508     for( i=0; i<size && i<NUM_UNCHOKED_PEERS_PER_TORRENT; ++i ) {
     1510    for( i=0; i<size && i<NUM_UNCHOKED_PEERS_PER_TORRENT; ++i )
    15091511        choke[i].doUnchoke = 1;
    1510         ++unchoked;
    1511     }
    15121512
    15131513    for( ; i<size; ++i ) {
    15141514        choke[i].doUnchoke = 1;
    1515         ++unchoked;
    15161515        if( choke[i].peer->peerIsInterested )
    15171516            break;
Note: See TracChangeset for help on using the changeset viewer.