Skip to content

Commit 6525900

Browse files
chopperbrianoclaude
andcommitted
Dashboard: converge fast after IPFS announce fix (win.19)
After pressing [F] the dashboard would continue polling every 10 minutes, so even after restarting IPFS Desktop the hint would stick around and the keepalive would keep sending relay addresses until the next poll. User couldn't tell whether the fix landed. Changes: - Add _ipfsAnnounceFixApplied flag, set when [F] completes successfully - While the flag is set and Kubo still isn't announcing directly, poll checkIpfsAnnounce() every 15 seconds instead of every 10 minutes - applyIpfsAnnounceFix() zeros _lastIpfsAnnounceCheck so the very next render pass runs a re-check immediately (no 15s wait before first poll) - checkIpfsAnnounce() clears the fix-applied flag and hint as soon as it sees the direct address appear in /id, falling back to the normal 10-minute poll interval - While waiting for restart, the hint text is now "Waiting for IPFS Desktop restart to pick up new announce list..." so it's clear what needs to happen - Replaced remaining em-dashes in user-visible strings with ASCII hyphens to prevent mojibake on CP437 consoles Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7e10ddc commit 6525900

3 files changed

Lines changed: 31 additions & 10 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ SET(PATCH_VERSION 0)
4040
SET(SO_VERSION 0)
4141

4242
# Windows port build number (increment for each Windows-specific release)
43-
SET(WIN_BUILD 18)
43+
SET(WIN_BUILD 19)
4444

4545
# Add source directory
4646
include_directories(src)

src/ConsoleDashboard.cpp

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,20 @@ void ConsoleDashboard::render() {
242242
std::thread([this]() { checkPspRegistration(); }).detach();
243243
}
244244
}
245-
// Run IPFS announce diagnosis in background (at startup + every 10 min)
245+
// Run IPFS announce diagnosis in background.
246+
// Poll fast (every 15s) while we're waiting for a user-applied fix to
247+
// take effect after IPFS Desktop restart; otherwise poll every 10 min.
246248
{
247249
auto now = std::chrono::steady_clock::now();
248250
auto elapsed = std::chrono::duration<double>(now - _lastIpfsAnnounceCheck).count();
249-
if (elapsed >= 600.0 || !_ipfsAnnounceChecked) {
251+
double interval = 600.0;
252+
{
253+
std::lock_guard<std::mutex> lock(_ipfsAnnounceMutex);
254+
if (_ipfsAnnounceFixApplied && !_ipfsAnnouncedDirectly) {
255+
interval = 15.0; // aggressive polling until Kubo picks up the change
256+
}
257+
}
258+
if (elapsed >= interval || !_ipfsAnnounceChecked) {
250259
// Only run once WebServer has had time to resolve external IP
251260
WebServer* ws = app->getWebServerIfSet();
252261
if (ws && !ws->getExternalIP().empty() && ws->getExternalIP() != "unknown") {
@@ -700,9 +709,14 @@ void ConsoleDashboard::checkIpfsAnnounce() {
700709
_lastIpfsAnnounceCheck = std::chrono::steady_clock::now();
701710

702711
if (announced) {
703-
_ipfsAnnounceHint.clear(); // nothing to fix
712+
// Convergence reached: the fix (manual or auto) has taken effect
713+
_ipfsAnnounceFixApplied = false;
714+
_ipfsAnnounceHint.clear();
715+
} else if (_ipfsAnnounceFixApplied) {
716+
// Fix was applied but Kubo hasn't picked it up yet — keep reminding
717+
_ipfsAnnounceHint = "Waiting for IPFS Desktop restart to pick up new announce list...";
704718
} else if (portOpen) {
705-
_ipfsAnnounceHint = "Port 4001 is open but IPFS isn't announcing it press [F] to fix";
719+
_ipfsAnnounceHint = "Port 4001 is open but IPFS isn't announcing it - press [F] to fix";
706720
} else {
707721
_ipfsAnnounceHint.clear(); // NAT'd with no port forward — relay path is the right answer
708722
}
@@ -766,12 +780,18 @@ bool ConsoleDashboard::applyIpfsAnnounceFix() {
766780
log->addMessage("Addresses.Announce updated successfully.");
767781
log->addMessage("IMPORTANT: restart IPFS Desktop (tray icon -> Quit, relaunch) "
768782
"to activate the new announce list.", Log::WARNING);
769-
log->addMessage("After IPFS restart, DigiAssetCore will automatically pick up "
770-
"the direct address on the next keepalive cycle.");
783+
log->addMessage("After IPFS restart, DigiAssetCore will verify the change "
784+
"automatically (checking every 15s).");
771785

772-
// Mark as applied so the hint goes away until next check
773-
std::lock_guard<std::mutex> lock(_ipfsAnnounceMutex);
774-
_ipfsAnnounceHint = "Addresses.Announce set — restart IPFS Desktop to activate";
786+
// Mark the fix as applied so the render loop polls aggressively until
787+
// Kubo picks up the new announce list. Reset _lastIpfsAnnounceCheck
788+
// to zero so the next render triggers an immediate re-check.
789+
{
790+
std::lock_guard<std::mutex> lock(_ipfsAnnounceMutex);
791+
_ipfsAnnounceFixApplied = true;
792+
_ipfsAnnounceHint = "Addresses.Announce set - restart IPFS Desktop to activate";
793+
_lastIpfsAnnounceCheck = std::chrono::steady_clock::time_point{};
794+
}
775795
return true;
776796
}
777797

src/ConsoleDashboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class ConsoleDashboard {
100100
bool _ipfsAnnouncedDirectly = false; // /id lists an address containing our WAN IP
101101
bool _ipfsPort4001Open = false; // ifconfig.co reports 4001 reachable
102102
bool _ipfsAnnounceChecked = false; // we've completed at least one check
103+
bool _ipfsAnnounceFixApplied = false; // F was pressed; poll aggressively until Kubo catches up
103104
std::string _ipfsAnnounceHint; // dashboard status line, empty if all good
104105
std::chrono::steady_clock::time_point _lastIpfsAnnounceCheck;
105106
void checkIpfsAnnounce(); // background: diagnose state, set hint

0 commit comments

Comments
 (0)