Changeset 7353
- Timestamp:
- Dec 11, 2008, 7:04:46 AM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr-private.h
r7231 r7353 63 63 char * client; 64 64 65 time_t peerSentPieceDataAt;66 65 time_t chokeChangedAt; 67 time_t pieceDataActivityDate;68 66 69 67 struct tr_peermsgs * msgs; -
trunk/libtransmission/peer-mgr.c
r7289 r7353 49 49 50 50 /* when many peers are available, keep idle ones this long */ 51 MIN_UPLOAD_IDLE_SECS = ( 60 * 3),51 MIN_UPLOAD_IDLE_SECS = ( 30 ), 52 52 53 53 /* when few peers are available, keep idle ones this long */ 54 MAX_UPLOAD_IDLE_SECS = ( 60 * 10),54 MAX_UPLOAD_IDLE_SECS = ( 60 * 5 ), 55 55 56 56 /* how frequently to decide which peers live and die */ … … 1019 1019 if( peer ) { 1020 1020 struct peer_atom * a = getExistingAtom( t, &peer->addr ); 1021 a->piece_data_time = now; 1021 if( e->wasPieceData ) 1022 a->piece_data_time = now; 1022 1023 } 1023 1024 … … 1057 1058 if( peer ) { 1058 1059 struct peer_atom * a = getExistingAtom( t, &peer->addr ); 1059 a->piece_data_time = now; 1060 if( e->wasPieceData ) 1061 a->piece_data_time = now; 1060 1062 } 1061 1063 … … 1241 1243 atom = getExistingAtom( t, addr ); 1242 1244 atom->time = time( NULL ); 1245 atom->piece_data_time = 0; 1243 1246 1244 1247 if( atom->myflags & MYFLAG_BANNED ) … … 2028 2031 const int lo = MIN_UPLOAD_IDLE_SECS; 2029 2032 const int hi = MAX_UPLOAD_IDLE_SECS; 2030 const int limit = lo +( ( hi - lo ) * strictness );2031 const time_t then = peer->pieceDataActivityDate;2032 const int idleTime = then ? ( now - then ) : 0; 2033 const int limit = hi - ( ( hi - lo ) * strictness ); 2034 const int idleTime = now - MAX( atom->time, atom->piece_data_time ); 2035 /*fprintf( stderr, "strictness is %.3f, limit is %d seconds... time since connect is %d, time since piece is %d ... idleTime is %d, doPurge is %d\n", (double)strictness, limit, (int)(now - atom->time), (int)(now - atom->piece_data_time), idleTime, idleTime > limit );*/ 2033 2036 if( idleTime > limit ) { 2034 2037 tordbg( t, "purging peer %s because it's been %d secs since we shared anything", … … 2220 2223 tr_peer * peer = connections[i]; 2221 2224 struct peer_atom * atom = getExistingAtom( t, &peer->addr ); 2222 if( peer->pieceDataActivityDate )2225 if( atom->piece_data_time ) 2223 2226 atom->numFails = 0; 2224 2227 else -
trunk/libtransmission/peer-msgs.c
r7323 r7353 1670 1670 **/ 1671 1671 1672 msgs->info->peerSentPieceDataAt = time( NULL );1673 1672 if(( err = tr_ioWrite( tor, req->index, req->offset, req->length, data ))) 1674 1673 return err;
Note: See TracChangeset
for help on using the changeset viewer.