Changeset 12254 for trunk/libtransmission/peer-mgr.c
- Timestamp:
- Mar 29, 2011, 3:23:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr.c
r12249 r12254 2284 2284 } 2285 2285 2286 static bool 2287 isAtomInteresting( const tr_torrent * tor, struct peer_atom * atom ) 2288 { 2289 if( tr_torrentIsSeed( tor ) && atomIsSeed( atom ) ) 2290 return false; 2291 2292 if( peerIsInUse( tor->torrentPeers, atom ) ) 2293 return true; 2294 2295 if( isAtomBlocklisted( tor->session, atom ) ) 2296 return false; 2297 2298 if( atom->flags2 & MYFLAG_BANNED ) 2299 return false; 2300 2301 return true; 2302 } 2303 2286 2304 int 2287 2305 tr_peerMgrGetPeers( tr_torrent * tor, … … 2303 2321 assert( setme_pex != NULL ); 2304 2322 assert( af==TR_AF_INET || af==TR_AF_INET6 ); 2305 assert( list_mode==TR_PEERS_CONNECTED || list_mode==TR_PEERS_ ALL);2323 assert( list_mode==TR_PEERS_CONNECTED || list_mode==TR_PEERS_INTERESTING ); 2306 2324 2307 2325 managerLock( t->manager ); … … 2320 2338 atoms[i] = peers[i]->atom; 2321 2339 } 2322 else /* TR_PEERS_ALL */ 2323 { 2324 const struct peer_atom ** atomsBase = (const struct peer_atom**) tr_ptrArrayBase( &t->pool ); 2325 atomCount = tr_ptrArraySize( &t->pool ); 2326 atoms = tr_memdup( atomsBase, atomCount * sizeof( struct peer_atom * ) ); 2340 else /* TR_PEERS_INTERESTING */ 2341 { 2342 int i; 2343 struct peer_atom ** atomBase = (struct peer_atom**) tr_ptrArrayBase( &t->pool ); 2344 n = tr_ptrArraySize( &t->pool ); 2345 atoms = tr_new( struct peer_atom *, n ); 2346 for( i=0; i<n; ++i ) 2347 if( isAtomInteresting( tor, atomBase[i] ) ) 2348 atoms[atomCount++] = atomBase[i]; 2327 2349 } 2328 2350
Note: See TracChangeset
for help on using the changeset viewer.