diff options
| author | erdgeist <> | 2006-12-13 02:44:39 +0000 |
|---|---|---|
| committer | erdgeist <> | 2006-12-13 02:44:39 +0000 |
| commit | d7c26dc71bd3cc04824ad979d31c1386dd5b1fa3 (patch) | |
| tree | 53a381164f1d1ccfc1ae048db077799c595bd837 /trackerlogic.c | |
| parent | 31c20c515d96c7311aa3483287202a48dd39cefb (diff) | |
Trackerlogic done... not tested yet
Diffstat (limited to 'trackerlogic.c')
| -rw-r--r-- | trackerlogic.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/trackerlogic.c b/trackerlogic.c index c57d1a9..5d83abb 100644 --- a/trackerlogic.c +++ b/trackerlogic.c | |||
| @@ -110,7 +110,22 @@ int vector_remove_torrent( ot_vector vector, ot_hash *hash ) { | |||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | void clean_peerlist( ot_peerlist peer_list ) { | 112 | void clean_peerlist( ot_peerlist peer_list ) { |
| 113 | exit( 1 ); | 113 | long timedout = NOW-peer_list->base; |
| 114 | int i; | ||
| 115 | |||
| 116 | if( !timedout ) return; | ||
| 117 | if( timedout > OT_POOLS_COUNT ) timedout = OT_POOLS_COUNT; | ||
| 118 | |||
| 119 | for( i=OT_POOLS_COUNT-timedout; i<OT_POOLS_COUNT; ++i ) | ||
| 120 | free( peer_list->peers[i].data); | ||
| 121 | |||
| 122 | MEMMOVE( peer_list->peers + timedout, peer_list->peers, sizeof( ot_vector ) * (OT_POOLS_COUNT-timedout) ); | ||
| 123 | byte_zero( peer_list->peers, sizeof( ot_vector ) * timedout ); | ||
| 124 | |||
| 125 | MEMMOVE( peer_list->seed_count + timedout, peer_list->seed_count, sizeof( unsigned long ) * (OT_POOLS_COUNT-timedout) ); | ||
| 126 | byte_zero( peer_list->seed_count, sizeof( unsigned long ) * timedout ); | ||
| 127 | |||
| 128 | peer_list->base = NOW; | ||
| 114 | } | 129 | } |
| 115 | 130 | ||
| 116 | ot_torrent add_peer_to_torrent( ot_hash *hash, ot_peer peer ) { | 131 | ot_torrent add_peer_to_torrent( ot_hash *hash, ot_peer peer ) { |
