Expire channels that have been unused for too long
Expire unused channels based on the discussion in issue #41 (closed) .
Merge request reports
Activity
- Resolved by yuan
@nickm Hi Nick, I have drafted some changes to expire unused channels. Hope I get the idea correctly.
requested review from @Diziet
Assigning myself as reviewer since I've been discussing this with @0x00A5 over the past while.
- Resolved by yuan
- Resolved by yuan
- Resolved by yuan
- Resolved by yuan
168 168 pub(super) fn remove(&mut self, id: CircId) -> Option<CircEnt> { 169 169 self.m.remove(&id) 170 170 } 171 172 /// Return the total number of open and opening entries in the map 173 pub(super) fn open_or_opening_ent_count(&self) -> usize { While working on resolving this, I noticed the
CircMap::get_mut
method.pub(super) fn get_mut(&mut self, id: CircId) -> Option<&mut CircEnt>
I figured to keep track of the open circs counter in all other methods but this one is a bit tricky. I guess one can change an entry from open/opening to destroy-sent (or vice versa) with the mutable reference returned, and the counter will be out of sync.
changed this line in version 2 of the diff
- Resolved by yuan
- Resolved by yuan
- Resolved by yuan
- Resolved by yuan
added 66 commits
-
1e80e8e8...4413645c - 65 commits from branch
tpo/core:main
- 8a0e2df6 - Expire channels that have been unused for too long
-
1e80e8e8...4413645c - 65 commits from branch
128 129 rsa_id: RsaIdentity, 129 130 /// If true, this channel is closing. 130 131 closed: AtomicBool, 132 /// Since when the channel became unused. 133 /// If None, this channle is still in use by at lesat one circuit. 134 unused_since: Mutex<Option<Timestamp>>, Hm... I think this is possible, but it might require a little work. Here's what I had in mind to get rid of the
Mutex
.I'd define a new
OptTimestamp
type, based on Timestamp, except with the value 0 representing None. It would behave semantically likeOption<Timestamp>
, but internally it would just be an AtomicU64. Then I'd give it bothupdate()
andclear()
functions to change its state, along with the other accessors that the functionsupdate_disused_since
andduration_unused
would need.That's kind of a lot, though. I'm happy to do try this myself post-merge, unless you want to take it on.
added 40 commits
-
8a0e2df6...cf4edcac - 39 commits from branch
tpo/core:main
- f6f732a4 - Expire channels that have been unused for too long
-
8a0e2df6...cf4edcac - 39 commits from branch
- Resolved by yuan
- Resolved by yuan