Stop IRC by hand; remove mDNS

IrcService::disconnect() stops the session from any state: QUIT if
connected, then no more retries. /quit goes through it (before, it only
stopped a connected session; while waiting for Wi-Fi or retrying it did
nothing), and so does the new `irc stop` command. Stopped by hand,
opening the IRC App no longer reconnects; typing a line does.

mDNS is gone: it never crossed the dev box's routed network, and it
cost about 7.5 KB of RAM. Pushes go to the IP shown in Settings ->
Firmware, which drops its Name row. OTA Q54 records the change.

On the device, Debug Build: 105.6 KB free with Wi-Fi (was 98); with IRC
on TLS 54 KB free (was 46); after `irc stop`, back to 99 KB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-04 23:17:48 +02:00
co-authored by Claude Opus 5.5
parent db265fb757
commit 4e439410cd
12 changed files with 39 additions and 23 deletions
+24 -7
View File
@@ -37,12 +37,19 @@ void IrcService::start() {
}
void IrcService::connect() {
stoppedByUser_ = false;
if (wanted_) return;
retryAtMs_ = millis();
backoff_.reset();
wanted_ = true;
}
void IrcService::disconnect() {
stoppedByUser_ = true;
stopRequested_ = true; // the IRC task says QUIT and closes; nothing to do if it never started
if (!task_) wanted_ = false;
}
int IrcService::totalUnread() {
Lock l(lock_);
return session_->totalUnread();
@@ -176,13 +183,10 @@ void IrcService::flushEffects() {
status_ = Status::Online;
backoff_.reset();
}
if (quit && open_) {
delay(300); // let QUIT reach the server
close("");
wanted_ = false;
status_ = Status::Stopped;
Lock l(lock_);
session_->disconnected(clock_.utcNow(), "disconnected");
if (quit) { // /quit: QUIT is already on its way if connected; stop in any state
stoppedByUser_ = true;
stopRequested_ = true;
quitSent_ = true;
}
}
@@ -192,6 +196,19 @@ void IrcService::loop() {
bool wifiUp = wifi_.state() == WifiController::State::Connected;
bool monitoring = wifi_.state() == WifiController::State::Monitoring;
if (stopRequested_) {
stopRequested_ = false;
if (open_) {
if (!quitSent_) conn_->print("QUIT :roro9stack\r\n");
vTaskDelay(pdMS_TO_TICKS(300)); // let QUIT reach the server
close("");
}
quitSent_ = false;
wanted_ = false;
status_ = Status::Stopped;
Lock l(lock_);
session_->disconnected(clock_.utcNow(), "disconnected (Enter reconnects)");
}
if (restart_) {
restart_ = false;
if (open_) {