Skip to content

Commit 95c1b5a

Browse files
myleshortonclaude
andcommitted
smc: _resolveAndEmit isClosed guard + honest 'session' stat label
Two Copilot fixes (+ a third pushback in the reply): 1. _resolveAndEmit awaits peerLookup. If the notifier is disposed during the await, _eventController.close() has already run; the subsequent _eventController.add would throw 'Bad state: Cannot add event after closing'. Added an isClosed check after the await before the identity check. 2. smc_stat_total_today msgstr read 'Total today' but the ShareState.totalCount is session-scoped (reset on every toggle-on, no day bucket, no persistence). Renamed to 'Total this session' so the label matches the implemented semantics. #8820's rebase later replaces this key with smc_stat_total_helped + 'Total people helped to date' alongside persistence via unboundedTotalHelped — until then the more honest 'session' wording matches reality. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 7d03f48 commit 95c1b5a

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

assets/locales/en.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ msgid "smc_stat_active_now"
612612
msgstr "Active now"
613613

614614
msgid "smc_stat_total_today"
615-
msgstr "Total today"
615+
msgstr "Total this session"
616616

617617
msgid "smc_connections_tooltip"
618618
msgstr "Most connections are short liveness probes — Lantern clients periodically check that this peer is reachable before sending real traffic. A quick burst from many locations is normal; an arc that lingers represents an actual user session."

lib/features/share_my_connection/share_my_connection.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,11 @@ class ShareNotifier extends Notifier<ShareState> {
486486
} catch (_) {
487487
geo = PeerGeo.unknown;
488488
}
489+
// The notifier could have been disposed during the await (provider
490+
// teardown closes _eventController). Guard before touching it so
491+
// a late lookup completion doesn't throw "Bad state: Cannot add
492+
// event after closing" on the disposed sink.
493+
if (_eventController.isClosed) return;
489494
// Peer may have disconnected before the lookup returned. The map
490495
// entry's identity (workerIdx) is the cheapest check.
491496
final current = _peerArcs[ip];

0 commit comments

Comments
 (0)