dht: expire announcement tokens after 30 minutes
dht::Database
was exhibiting unbounded memory consumption due to generating and remembering announcement tokens without ever expiring and forgetting them. This commit augments the existing dht::Database::expire(bt::Timestamp)
function so that it erases tokens that are more than MAX_ITEM_AGE
(30 minutes) old. Also, it deletes and erases DBItemList
instances when they have been emptied by expirations.
Anecdotal note: Prior to this commit, my KTorrent instance would gradually consume more and more memory over time, rising to well past 1 GiB in as little as a week. After this commit, KTorrent's memory consumption remains fairly stable.