Changeset 7580 for trunk/libtransmission/peer-mgr.c
- Timestamp:
- Jan 2, 2009, 7:56:06 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr.c
r7578 r7580 319 319 320 320 static tr_peer* 321 peerConstructor( tr_torrent * tor,const tr_address * addr )321 peerConstructor( const tr_address * addr ) 322 322 { 323 323 tr_peer * p; 324 324 p = tr_new0( tr_peer, 1 ); 325 325 p->addr = *addr; 326 p->bandwidth = tr_bandwidthNew( tor->session, tor->bandwidth );327 326 return p; 328 327 } … … 340 339 if( peer == NULL ) 341 340 { 342 peer = peerConstructor( torrent->tor,addr );341 peer = peerConstructor( addr ); 343 342 tr_ptrArrayInsertSorted( &torrent->peers, peer, peerCompare ); 344 343 } … … 363 362 tr_bitfieldFree( peer->blame ); 364 363 tr_free( peer->client ); 365 366 tr_bandwidthFree( peer->bandwidth );367 364 368 365 tr_free( peer ); … … 1271 1268 peer->port = port; 1272 1269 peer->io = tr_handshakeStealIO( handshake ); 1270 tr_peerIoSetParent( peer->io, t->tor->bandwidth ); 1273 1271 tr_peerMsgsNew( t->tor, peer, peerCallbackFunc, t, &peer->msgsTag ); 1274 tr_peerIoSetBandwidth( io, peer->bandwidth );1275 1272 1276 1273 success = TRUE; … … 1310 1307 tr_handshake * handshake; 1311 1308 1312 io = tr_peerIoNewIncoming( manager->session, addr, port, socket );1309 io = tr_peerIoNewIncoming( manager->session, manager->session->bandwidth, addr, port, socket ); 1313 1310 1314 1311 handshake = tr_handshakeNew( io, … … 1818 1815 tr_peerGetPieceSpeed( const tr_peer * peer, tr_direction direction ) 1819 1816 { 1820 assert( peer ); 1821 assert( direction==TR_CLIENT_TO_PEER || direction==TR_PEER_TO_CLIENT ); 1822 1823 return tr_bandwidthGetPieceSpeed( peer->bandwidth, direction ); 1817 return peer->io ? tr_peerIoGetPieceSpeed( peer->io, direction ) : 0.0; 1824 1818 } 1825 1819 … … 2316 2310 tr_peerIoAddrStr( &atom->addr, atom->port ) ); 2317 2311 2318 io = tr_peerIoNewOutgoing( mgr->session, &atom->addr, atom->port, t->hash ); 2312 io = tr_peerIoNewOutgoing( mgr->session, mgr->session->bandwidth, &atom->addr, atom->port, t->hash ); 2313 2319 2314 if( io == NULL ) 2320 2315 {
Note: See TracChangeset
for help on using the changeset viewer.