Remove the use of Mutex in channel unused_since timestamp
Create OptTimestamp
so that we can remove the use of Mutex
in channel details' unused_since
timestamp as described in issue #324 (closed) .
Merge request reports
Activity
@nickm Hi! I have done some copy-and-paste
, which makes me wonder if we can just changeTimestamp
's API toOptTimestamp
's?requested review from @nickm
Oh! That actually makes a lot of sense. In fact, now that you ask, I think that Timestamp's behavior is in fact closer to being an "optional timestamp": When it's created, it holds 0, the "no timestamp" value. This could cause bugs with
LAST_INCOMING_TRAFFIC
someday.So I think for now, maybe this "optional timestamp' API is the only one we should have? (It isn't super important what we call it, since it isn't exposed outside of
tor-proto
.)
added 15 commits
-
26a67b14...ba2eb765 - 14 commits from branch
tpo/core:main
- 595fe1ab - Remove the use of Mutex in channel unused_since timestamp
-
26a67b14...ba2eb765 - 14 commits from branch
580 580 fn note_circ_timeout(&mut self, hop: u8, delay: Duration) { 581 581 // Only record this timeout if we have seen some network activity since 582 582 // we launched the circuit. 583 let last_traffic = tor_proto::time_since_last_incoming_traffic(); 584 let have_seen_recent_activity = last_traffic < delay; 583 let have_seen_recent_activity = 584 if let Some(last_traffic) = tor_proto::time_since_last_incoming_traffic() { 585 last_traffic < delay 586 } else { 587 true 470 470 // we don't mark all the primary guards as retriable unless 471 471 // we've been forced to non-primary guards. 472 let net_has_been_down = inner 473 .guards 474 .active_guards_mut() 475 .all_primary_guards_are_unreachable() 476 && tor_proto::time_since_last_incoming_traffic() >= inner.params.internet_down_timeout; 472 let net_has_been_down = 473 if let Some(duration) = tor_proto::time_since_last_incoming_traffic() { 474 inner 475 .guards 476 .active_guards_mut() 477 .all_primary_guards_are_unreachable() 478 && duration >= inner.params.internet_down_timeout 479 } else { 480 false mentioned in commit e8244c33
mentioned in issue #324 (closed)