Add '重试直连' button to punch-status banner

In relay mode, the banner now exposes a single button that calls
sessionReconnect(sessionId, forceRelay=false). This:
  - resets the is_force_relay flag in the Session lc state
  - triggers a fresh punch attempt (with the same direct_failures counter,
    which only shortens the punch timeout, never skips the attempt)
  - if punch succeeds, banner flips to green and file transfer re-enables

The button is disabled (greyed out) if sessionId is not yet known.

User's setup has both Macs with global IPv6 (2409:8a1e::, China Mobile),
but punch still falls back to relay. Common cause: CGNAT, double-NAT, or
symmetric NAT. The retry button lets the user test network conditions
without restarting the app.

Removed: my earlier attempt at main_get_logs / session_get_session_id FFI
bridges — couldn't find the right log path / session API, and the
sessionId is already exposed via RemotePage.sessionId getter.
This commit is contained in:
xuwenwei
2026-06-09 11:30:15 +08:00
parent f5a6b033ff
commit 6811508178
2 changed files with 39 additions and 2 deletions
+4 -1
View File
@@ -492,7 +492,10 @@ class _RemotePageState extends State<RemotePage>
top: 0,
left: 0,
right: 0,
child: PunchStatusBanner(peerId: widget.id),
child: PunchStatusBanner(
peerId: widget.id,
sessionId: widget.sessionId,
),
),
],
);