Changeset 11532
- Timestamp:
- Dec 14, 2010, 6:33:48 PM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr.c
r11528 r11532 80 80 PIECE_LIST_SHELF_LIFE_SECS = 60, 81 81 82 /* use for bitwise operations w/peer_atom. myflags*/82 /* use for bitwise operations w/peer_atom.flags2 */ 83 83 MYFLAG_BANNED = 1, 84 84 85 /* use for bitwise operations w/peer_atom. myflags*/85 /* use for bitwise operations w/peer_atom.flags2 */ 86 86 /* unreachable for now... but not banned. 87 87 * if they try to connect to us it's okay */ … … 124 124 uint8_t from; 125 125 uint8_t flags; /* these match the added_f flags */ 126 uint8_t myflags;/* flags that aren't defined in added_f */126 uint8_t flags2; /* flags that aren't defined in added_f */ 127 127 uint8_t uploadOnly; /* UPLOAD_ONLY_ */ 128 128 int8_t seedProbability; /* how likely is this to be a seed... [0..100] or -1 for unknown */ … … 1242 1242 { 1243 1243 struct peer_atom * atom = peer->atom; 1244 atom-> myflags|= MYFLAG_BANNED;1244 atom->flags2 |= MYFLAG_BANNED; 1245 1245 peer->doPurge = 1; 1246 1246 tordbg( t, "banning peer %s", tr_atomAddrStr( atom ) ); … … 1650 1650 { 1651 1651 tordbg( t, "marking peer %s as unreachable... numFails is %d", tr_atomAddrStr( atom ), (int)atom->numFails ); 1652 atom-> myflags|= MYFLAG_UNREACHABLE;1652 atom->flags2 |= MYFLAG_UNREACHABLE; 1653 1653 } 1654 1654 } … … 1664 1664 atom->piece_data_time = 0; 1665 1665 atom->lastConnectionAt = tr_time( ); 1666 atom->myflags &= ~MYFLAG_UNREACHABLE; 1667 1668 if( atom->myflags & MYFLAG_BANNED ) 1666 1667 if( !tr_peerIoIsIncoming( io ) ) 1668 { 1669 atom->flags |= ADDED_F_CONNECTABLE; 1670 atom->flags2 &= ~MYFLAG_UNREACHABLE; 1671 } 1672 1673 if( atom->flags2 & MYFLAG_BANNED ) 1669 1674 { 1670 1675 tordbg( t, "banned peer %s tried to reconnect", … … 2932 2937 2933 2938 /* penalize peers that were unreachable the last time we tried */ 2934 if( atom-> myflags& MYFLAG_UNREACHABLE )2939 if( atom->flags2 & MYFLAG_UNREACHABLE ) 2935 2940 sec += sec; 2936 2941 … … 3377 3382 3378 3383 /* not if they're banned... */ 3379 if( atom-> myflags& MYFLAG_BANNED )3384 if( atom->flags2 & MYFLAG_BANNED ) 3380 3385 return FALSE; 3381 3386 … … 3434 3439 /* prefer torrents we're downloading with */ 3435 3440 i = tr_torrentIsSeed( tor ) ? 1 : 0; 3441 score = addValToKey( score, 1, i ); 3442 3443 /* prefer peers that are known to be connectible */ 3444 i = ( atom->flags & ADDED_F_CONNECTABLE ) ? 0 : 1; 3436 3445 score = addValToKey( score, 1, i ); 3437 3446 … … 3561 3570 tordbg( t, "peerIo not created; marking peer %s as unreachable", 3562 3571 tr_atomAddrStr( atom ) ); 3563 atom-> myflags|= MYFLAG_UNREACHABLE;3572 atom->flags2 |= MYFLAG_UNREACHABLE; 3564 3573 atom->numFails++; 3565 3574 } -
trunk/libtransmission/peer-mgr.h
r11295 r11532 39 39 typedef struct tr_peerMgr tr_peerMgr; 40 40 41 /* added_f's bitwise-or'ed flags */ 41 42 enum 42 43 { 43 /* corresponds to ut_pex's added.f flags*/44 /* true if the peer supports encryption */ 44 45 ADDED_F_ENCRYPTION_FLAG = 1, 45 46 46 /* corresponds to ut_pex's added.f flags*/47 /* true if the peer is a seed or partial seed */ 47 48 ADDED_F_SEED_FLAG = 2, 49 50 /* true if the peer supports uTP */ 51 ADDED_F_UTP_FLAGS = 4, 52 53 /* true if the peer has holepunch support */ 54 ADDED_F_HOLEPUNCH = 8, 55 56 /* true if the peer telling us about this peer 57 * initiated the connection (implying that it is connectible) */ 58 ADDED_F_CONNECTABLE = 16 48 59 }; 49 60
Note: See TracChangeset
for help on using the changeset viewer.