summaryrefslogtreecommitdiff
path: root/src/trackerlogic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/trackerlogic.c')
-rw-r--r--src/trackerlogic.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/trackerlogic.c b/src/trackerlogic.c
index 8e30a48..60d5b18 100644
--- a/src/trackerlogic.c
+++ b/src/trackerlogic.c
@@ -38,10 +38,17 @@ void free_peerlist(ot_peerlist *peer_list) {
38 free(peer_list); 38 free(peer_list);
39} 39}
40 40
41void add_torrent_from_saved_state(ot_hash const hash, ot_time base, size_t down_count) { 41/* How many minutes before this moment the torrent was last touched, which is
42 what a state dump records. */
43void add_torrent_from_saved_state(ot_hash const hash, ot_time age, size_t down_count) {
42 int exactmatch; 44 int exactmatch;
43 ot_torrent *torrent; 45 ot_torrent *torrent;
44 ot_vector *torrents_list = mutex_bucket_lock_by_hash(hash); 46 ot_vector *torrents_list;
47
48 if (age > OT_TORRENT_TIMEOUT)
49 return;
50
51 torrents_list = mutex_bucket_lock_by_hash(hash);
45 52
46 if (!accesslist_hashisvalid(hash)) { 53 if (!accesslist_hashisvalid(hash)) {
47 mutex_bucket_unlock_by_hash(hash, 0); 54 mutex_bucket_unlock_by_hash(hash, 0);
@@ -66,8 +73,8 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time base, size_t down_
66 73
67 memset(torrent->peer_list6, 0, sizeof(ot_peerlist)); 74 memset(torrent->peer_list6, 0, sizeof(ot_peerlist));
68 memset(torrent->peer_list4, 0, sizeof(ot_peerlist)); 75 memset(torrent->peer_list4, 0, sizeof(ot_peerlist));
69 torrent->peer_list6->base = base; 76 torrent->peer_list6->base = time_now_minutes() - age;
70 torrent->peer_list4->base = base; 77 torrent->peer_list4->base = time_now_minutes() - age;
71 torrent->peer_list6->down_count = down_count; 78 torrent->peer_list6->down_count = down_count;
72 torrent->peer_list4->down_count = down_count; 79 torrent->peer_list4->down_count = down_count;
73 80