Changeset 13947
- Timestamp:
- Feb 3, 2013, 10:40:00 PM (8 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-common.h
r13936 r13947 28 28 29 29 #include "transmission.h" 30 31 struct tr_bitfield; 30 #include "bitfield.h" 31 #include "history.h" 32 #include "quark.h" 32 33 33 34 enum … … 81 82 extern const tr_peer_event TR_PEER_EVENT_INIT; 82 83 83 struct tr_peer; 84 /** 85 * State information about a connected peer. 86 * 87 * @see struct peer_atom 88 * @see tr_peermsgs 89 */ 90 typedef struct tr_peer 91 { 92 /* whether or not we should free this peer soon. 93 NOTE: private to peer-mgr.c */ 94 bool doPurge; 95 96 /* Whether or not we've choked this peer. 97 Only applies to BitTorrent peers */ 98 bool peerIsChoked; 99 100 /* whether or not the peer has indicated it will download from us. 101 Only applies to BitTorrent peers */ 102 bool peerIsInterested; 103 104 /* whether or the peer is choking us. 105 Only applies to BitTorrent peers */ 106 bool clientIsChoked; 107 108 /* whether or not we've indicated to the peer that we would download from them if unchoked. 109 Only applies to BitTorrent peers */ 110 bool clientIsInterested; 111 112 /* number of bad pieces they've contributed to */ 113 uint8_t strikes; 114 115 uint8_t encryption_preference; 116 117 /* how many requests the peer has made that we haven't responded to yet */ 118 int pendingReqsToClient; 119 120 /* how many requests we've made and are currently awaiting a response for */ 121 int pendingReqsToPeer; 122 123 struct tr_peerIo * io; 124 struct peer_atom * atom; 125 126 /** how complete the peer's copy of the torrent is. [0.0...1.0] */ 127 float progress; 128 129 struct tr_bitfield blame; 130 struct tr_bitfield have; 131 132 /* the client name. 133 For BitTorrent peers, this is the app name derived from the `v' string in LTEP's handshake dictionary */ 134 tr_quark client; 135 136 time_t chokeChangedAt; 137 138 tr_recentHistory blocksSentToClient; 139 tr_recentHistory blocksSentToPeer; 140 141 tr_recentHistory cancelsSentToClient; 142 tr_recentHistory cancelsSentToPeer; 143 144 struct tr_peermsgs * msgs; 145 } 146 tr_peer; 84 147 85 148 typedef void tr_peer_callback (struct tr_peer * peer, -
trunk/libtransmission/peer-mgr.h
r13936 r13947 24 24 #endif 25 25 26 #include "bitfield.h"27 #include "history.h"28 26 #include "net.h" /* tr_address */ 29 #include "peer-common.h" /* struct peer_request */27 #include "peer-common.h" 30 28 #include "quark.h" 31 29 … … 81 79 /* opaque forward declaration */ 82 80 struct peer_atom; 83 84 /**85 * State information about a connected peer.86 *87 * @see struct peer_atom88 * @see tr_peermsgs89 */90 typedef struct tr_peer91 {92 bool peerIsChoked;93 bool peerIsInterested;94 bool clientIsChoked;95 bool clientIsInterested;96 bool doPurge;97 98 /* number of bad pieces they've contributed to */99 uint8_t strikes;100 101 uint8_t encryption_preference;102 tr_port dht_port;103 104 /* how many requests the peer has made that we haven't responded to yet */105 int pendingReqsToClient;106 107 /* how many requests we've made and are currently awaiting a response for */108 int pendingReqsToPeer;109 110 struct tr_peerIo * io;111 struct peer_atom * atom;112 113 struct tr_bitfield blame;114 struct tr_bitfield have;115 116 /** how complete the peer's copy of the torrent is. [0.0...1.0] */117 float progress;118 119 /* the client name from the `v' string in LTEP's handshake dictionary */120 tr_quark client;121 122 time_t chokeChangedAt;123 124 tr_recentHistory blocksSentToClient;125 tr_recentHistory blocksSentToPeer;126 127 tr_recentHistory cancelsSentToClient;128 tr_recentHistory cancelsSentToPeer;129 130 struct tr_peermsgs * msgs;131 }132 tr_peer;133 81 134 82 void tr_peerConstruct (struct tr_peer * peer); -
trunk/libtransmission/peer-msgs.c
r13900 r13947 177 177 uint16_t pexCount; 178 178 uint16_t pexCount6; 179 180 tr_port dht_port; 179 181 180 182 size_t metadata_size_hint; … … 1467 1469 case BT_PORT: 1468 1470 dbgmsg (msgs, "Got a BT_PORT"); 1469 tr_peerIoReadUint16 (msgs->peer->io, inbuf, &msgs-> peer->dht_port);1470 if (msgs-> peer->dht_port > 0)1471 tr_peerIoReadUint16 (msgs->peer->io, inbuf, &msgs->dht_port); 1472 if (msgs->dht_port > 0) 1471 1473 tr_dhtAddNode (getSession (msgs), 1472 1474 tr_peerAddress (msgs->peer), 1473 msgs-> peer->dht_port, 0);1475 msgs->dht_port, 0); 1474 1476 break; 1475 1477
Note: See TracChangeset
for help on using the changeset viewer.