Changeset 774


Ignore:
Timestamp:
Aug 14, 2006, 10:42:32 PM (15 years ago)
Author:
joshe
Message:

Retrieve peer address as a string via tr_torrentPeers().

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer.c

    r754 r774  
    307307
    308308/***********************************************************************
     309 * tr_peerAddress
     310 ***********************************************************************
     311 *
     312 **********************************************************************/
     313struct in_addr * tr_peerAddress( tr_peer_t * peer )
     314{
     315    return &peer->addr;
     316}
     317
     318/***********************************************************************
    309319 * tr_peerHash
    310320 ***********************************************************************
  • trunk/libtransmission/peer.h

    r764 r774  
    5353void        tr_peerBlame         ( tr_torrent_t *, tr_peer_t *,
    5454                                   int piece, int success );
     55struct in_addr * tr_peerAddress  ( tr_peer_t * );
    5556
    5657#endif
  • trunk/libtransmission/transmission.c

    r772 r774  
    495495    {
    496496        tr_peer_t * peer;
     497        struct in_addr * addr;
    497498        int i = 0;
    498499        for( i = 0; i < tor->peerCount; i++ )
     
    500501            peer = tor->peers[i];
    501502           
     503            addr = tr_peerAddress( peer );
     504            if( NULL != addr )
     505            {
     506                inet_ntop( AF_INET, addr, peers[i].addr,
     507                           sizeof( peers[i].addr ) );
     508            }
    502509            peers[i].client = tr_clientForId(tr_peerId(peer));
    503510            peers[i].isDownloading = tr_peerIsDownloading(peer);
  • trunk/libtransmission/transmission.h

    r767 r774  
    4545#endif
    4646
     47#ifndef INET_ADDRSTRLEN
     48#define INET_ADDRSTRLEN 16
     49#endif
     50
    4751#define TR_DEFAULT_PORT   9090
    4852#define TR_NOERROR        0
     
    322326struct tr_peer_stat_s
    323327{
     328    char    addr[INET_ADDRSTRLEN];
    324329    char *  client;
    325330   
Note: See TracChangeset for help on using the changeset viewer.