Linux + iPhone Continuity / iMessage / SMS
fix: avahi error handling
Zack Bartel43c8575d55e2
diff --git a/po/cs.po b/po/cs.poindex 7e944f0..c355204 100644--- a/po/cs.po+++ b/po/cs.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Czech\n"@@ -238,7 +238,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Vazba"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -853,6 +854,16 @@ msgstr "Přijmout"msgid "Reject"msgstr "Odmítnout"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Soubor dorazil"@@ -1005,6 +1016,12 @@ msgstr "Složky nelze odeslat — přetáhněte místo nich soubory."msgid "Clipboard, files, and OTP are connected."msgstr "Schránka, soubory a OTP jsou připojeny."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/de.po b/po/de.poindex 948dad6..57cf03c 100644--- a/po/de.po+++ b/po/de.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: German\n"@@ -236,7 +236,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Bindung"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -872,6 +873,16 @@ msgstr "Annehmen"msgid "Reject"msgstr "Ablehnen"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Datei empfangen"@@ -1029,6 +1040,12 @@ msgstr ""msgid "Clipboard, files, and OTP are connected."msgstr "Zwischenablage, Dateien und OTP sind verbunden."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/es.po b/po/es.poindex 9596d6d..89f6e3e 100644--- a/po/es.po+++ b/po/es.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: Spanish\n"@@ -238,7 +238,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Vínculo"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -300,7 +301,8 @@ msgid """ Cannot confirm the pairing code: input is not a terminal.\n"msgstr """\n"-" No se puede confirmar el código de emparejamiento: la entrada no es un terminal.\n"+" No se puede confirmar el código de emparejamiento: la entrada no es un "+"terminal.\n"#: src/cli/main.cppmsgid "Could not read Bluetooth connection state from the daemon.\n"@@ -864,6 +866,16 @@ msgstr "Aceptar"msgid "Reject"msgstr "Rechazar"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Archivo recibido"@@ -1020,6 +1032,12 @@ msgstr "No se pueden enviar carpetas — suelte archivos en su lugar."msgid "Clipboard, files, and OTP are connected."msgstr "El portapapeles, los archivos y los OTP están conectados."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/fr.po b/po/fr.poindex a4796f3..28c03f7 100644--- a/po/fr.po+++ b/po/fr.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: French\n"@@ -240,7 +240,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Lien"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -302,7 +303,8 @@ msgid """ Cannot confirm the pairing code: input is not a terminal.\n"msgstr """\n"-" Impossible de confirmer le code d’association : l’entrée n’est pas un terminal.\n"+" Impossible de confirmer le code d’association : l’entrée n’est pas un "+"terminal.\n"#: src/cli/main.cppmsgid "Could not read Bluetooth connection state from the daemon.\n"@@ -868,6 +870,16 @@ msgstr "Accepter"msgid "Reject"msgstr "Refuser"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Fichier reçu"@@ -1024,6 +1036,12 @@ msgstr ""msgid "Clipboard, files, and OTP are connected."msgstr "Le presse-papiers, les fichiers et les OTP sont connectés."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/it.po b/po/it.poindex 92328d0..8ab908d 100644--- a/po/it.po+++ b/po/it.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Italian\n"@@ -238,7 +238,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Associazione"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -300,7 +301,8 @@ msgid """ Cannot confirm the pairing code: input is not a terminal.\n"msgstr """\n"-" Impossibile confermare il codice di accoppiamento: l’input non è un terminale.\n"+" Impossibile confermare il codice di accoppiamento: l’input non è un "+"terminale.\n"#: src/cli/main.cppmsgid "Could not read Bluetooth connection state from the daemon.\n"@@ -863,6 +865,16 @@ msgstr "Accetta"msgid "Reject"msgstr "Rifiuta"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "File ricevuto"@@ -1018,6 +1030,12 @@ msgstr "Le cartelle non possono essere inviate — trascina dei file."msgid "Clipboard, files, and OTP are connected."msgstr "Appunti, file e OTP sono connessi."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr "Nessun iPhone accoppiato è connesso. Apri l'app Tether sul telefono."diff --git a/po/ja.po b/po/ja.poindex 23770d7..2189d9c 100644--- a/po/ja.po+++ b/po/ja.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Japanese\n"@@ -232,7 +232,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "ボンド"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -835,6 +836,16 @@ msgstr "承認"msgid "Reject"msgstr "拒否"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "ファイルが届きました"@@ -989,6 +1000,12 @@ msgstr "フォルダは送信できません。ファイルをドロップしてmsgid "Clipboard, files, and OTP are connected."msgstr "クリップボード、ファイル、OTP が接続されています。"+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/ko.po b/po/ko.poindex c49bb47..786b58f 100644--- a/po/ko.po+++ b/po/ko.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Korean\n"@@ -231,7 +231,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "본드"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -830,6 +831,16 @@ msgstr "수락"msgid "Reject"msgstr "거부"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "파일이 도착했습니다"@@ -982,6 +993,12 @@ msgstr "폴더는 보낼 수 없습니다. 대신 파일을 놓으십시오."msgid "Clipboard, files, and OTP are connected."msgstr "클립보드, 파일, OTP가 연결되었습니다."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr "연결된 페어링 iPhone이 없습니다. iPhone에서 Tether 앱을 여십시오."diff --git a/po/nl.po b/po/nl.poindex cc8a842..8a436b0 100644--- a/po/nl.po+++ b/po/nl.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Dutch\n"@@ -237,7 +237,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Koppeling"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -859,6 +860,16 @@ msgstr "Accepteren"msgid "Reject"msgstr "Weigeren"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Bestand ontvangen"@@ -1014,6 +1025,12 @@ msgstr ""msgid "Clipboard, files, and OTP are connected."msgstr "Klembord, bestanden en OTP zijn verbonden."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/pl.po b/po/pl.poindex d7ff33b..a1ae30b 100644--- a/po/pl.po+++ b/po/pl.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Polish\n"@@ -239,7 +239,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Powiązanie"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -862,6 +863,16 @@ msgstr "Akceptuj"msgid "Reject"msgstr "Odrzuć"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Plik dotarł"@@ -1015,6 +1026,12 @@ msgstr "Folderów nie można wysyłać — przeciągnij zamiast nich pliki."msgid "Clipboard, files, and OTP are connected."msgstr "Schowek, pliki i OTP są połączone."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/pt_BR.po b/po/pt_BR.poindex a01fc44..e8c50ee 100644--- a/po/pt_BR.po+++ b/po/pt_BR.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Brazilian Portuguese\n"@@ -236,7 +236,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Vínculo"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -298,7 +299,8 @@ msgid """ Cannot confirm the pairing code: input is not a terminal.\n"msgstr """\n"-" Não é possível confirmar o código de pareamento: a entrada não é um terminal.\n"+" Não é possível confirmar o código de pareamento: a entrada não é um "+"terminal.\n"#: src/cli/main.cppmsgid "Could not read Bluetooth connection state from the daemon.\n"@@ -858,6 +860,16 @@ msgstr "Aceitar"msgid "Reject"msgstr "Recusar"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Arquivo recebido"@@ -1011,6 +1023,12 @@ msgstr "Pastas não podem ser enviadas — solte arquivos em vez disso."msgid "Clipboard, files, and OTP are connected."msgstr "Área de transferência, arquivos e OTP estão conectados."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr "Nenhum iPhone pareado está conectado. Abra o app Tether no telefone."diff --git a/po/ru.po b/po/ru.poindex 1b5de31..897f910 100644--- a/po/ru.po+++ b/po/ru.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Russian\n"@@ -239,7 +239,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Связь"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -861,6 +862,16 @@ msgstr "Принять"msgid "Reject"msgstr "Отклонить"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Файл получен"@@ -1016,6 +1027,12 @@ msgstr "Папки отправить нельзя — перетащите вмmsgid "Clipboard, files, and OTP are connected."msgstr "Буфер обмена, файлы и OTP подключены."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/sv.po b/po/sv.poindex 8ac7a38..7c33fdd 100644--- a/po/sv.po+++ b/po/sv.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Swedish\n"@@ -236,7 +236,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Bindning"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -848,6 +849,16 @@ msgstr "Godkänn"msgid "Reject"msgstr "Avvisa"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Fil mottagen"@@ -1001,6 +1012,12 @@ msgstr "Mappar kan inte skickas — släpp filer i stället."msgid "Clipboard, files, and OTP are connected."msgstr "Urklipp, filer och OTP är anslutna."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr "Ingen parkopplad iPhone är ansluten. Öppna Tether-appen på telefonen."diff --git a/po/tether.pot b/po/tether.potindex 251ea2f..4d51d3c 100644--- a/po/tether.pot+++ b/po/tether.pot@@ -6,9 +6,9 @@#, fuzzymsgid ""msgstr ""-"Project-Id-Version: tether 0.2.13\n"+"Project-Id-Version: tether 0.2.14\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <[email protected]>\n"@@ -224,7 +224,8 @@ msgstr ""msgid "Bond"msgstr ""-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr ""@@ -764,6 +765,16 @@ msgstr ""msgid "Reject"msgstr ""+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr ""@@ -913,6 +924,12 @@ msgstr ""msgid "Clipboard, files, and OTP are connected."msgstr ""+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/tr.po b/po/tr.poindex 8941b7b..056f918 100644--- a/po/tr.po+++ b/po/tr.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Turkish\n"@@ -235,7 +235,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Bağ"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -847,6 +848,16 @@ msgstr "Kabul et"msgid "Reject"msgstr "Reddet"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Dosya geldi"@@ -998,6 +1009,12 @@ msgstr "Klasörler gönderilemez — bunun yerine dosya bırakın."msgid "Clipboard, files, and OTP are connected."msgstr "Pano, dosyalar ve OTP bağlı."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/uk.po b/po/uk.poindex c88399b..bd57cf0 100644--- a/po/uk.po+++ b/po/uk.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Ukrainian\n"@@ -240,7 +240,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "Зв'язок"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -858,6 +859,16 @@ msgstr "Прийняти"msgid "Reject"msgstr "Відхилити"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "Файл надійшов"@@ -1012,6 +1023,12 @@ msgstr "Теки надіслати не можна — перетягнітьmsgid "Clipboard, files, and OTP are connected."msgstr "Буфер обміну, файли та OTP під'єднано."+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr ""diff --git a/po/zh_CN.po b/po/zh_CN.poindex 9ddbf51..b95e828 100644--- a/po/zh_CN.po+++ b/po/zh_CN.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-26 14:40-0700\n"+"POT-Creation-Date: 2026-08-27 20:41-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Simplified Chinese\n"@@ -229,7 +229,8 @@ msgstr "Secure Connections={}"msgid "Bond"msgstr "绑定"-#: src/cli/main.cpp src/gtk/main.cpp src/gtk/tether-gtk.desktop.in+#: src/cli/main.cpp src/daemon/main.cpp src/gtk/main.cpp+#: src/gtk/tether-gtk.desktop.inmsgid "Tether"msgstr "Tether"@@ -809,6 +810,16 @@ msgstr "接受"msgid "Reject"msgstr "拒绝"+#: src/daemon/main.cpp+msgid "This PC can't be discovered"+msgstr ""++#: src/daemon/main.cpp+msgid ""+"avahi-daemon isn't running, so Tether can't advertise itself on the network. "+"Start it with: sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/daemon/notification.cppmsgid "File arrived"msgstr "文件已送达"@@ -960,6 +971,12 @@ msgstr "无法发送文件夹 —— 请改为拖放文件。"msgid "Clipboard, files, and OTP are connected."msgstr "剪贴板、文件和 OTP 已连接。"+#: src/gtk/devices_view.cpp+msgid ""+"avahi-daemon isn't running, so the iPhone can't find this PC. Start it with: "+"sudo systemctl enable --now avahi-daemon"+msgstr ""+#: src/gtk/devices_view.cppmsgid "No paired iPhone is connected. Open the Tether app on the phone."msgstr "没有已配对的 iPhone 处于连接状态。请在 iPhone 上打开 Tether App。"diff --git a/src/core/include/tether/discovery.hpp b/src/core/include/tether/discovery.hppindex b6ccdf7..dab7ba9 100644--- a/src/core/include/tether/discovery.hpp+++ b/src/core/include/tether/discovery.hpp@@ -48,11 +48,18 @@ namespace tether {Discovery(Discovery&&) noexcept;Discovery& operator=(Discovery&&) noexcept;+ // Reported when mDNS availability changes: false while avahi-daemon is+ // down, true once a client is connected to it.+ using StateCallback = std::function<void(bool available)>;+ void set_state_callback(StateCallback cb);+// Publish this tetherd instance on the local network.// @param name Human-readable service name (typically the hostname).// @param port TCP port the daemon is listening on.// @param fingerprint SHA-256 fingerprint of the daemon's TLS certificate.- // @return true if the service was successfully registered.+ // @return true if publishing was set up. Registration itself is+ // asynchronous and waits for avahi-daemon, which need not be+ // running yet; watch set_state_callback() for the outcome.bool publish(const std::string& name, uint16_t port, const std::string& fingerprint);// Stop advertising this instance. Called automatically by the destructor.diff --git a/src/core/include/tether/log.hpp b/src/core/include/tether/log.hppindex 9289b66..f6a847a 100644--- a/src/core/include/tether/log.hpp+++ b/src/core/include/tether/log.hpp@@ -5,6 +5,8 @@#include <format>#include <iomanip>#include <iostream>+#include <mutex>+#include <sstream>template <> struct std::formatter<std::filesystem::path> : std::formatter<std::string> {auto format(const std::filesystem::path& p, std::format_context& ctx) const {@@ -17,6 +19,28 @@ enum LogLevel { TRACE = 0, DEBUG, INFO, WARN, ERR, CRIT };namespace debug {inline bool verbose = false;inline bool quiet = false;++ inline std::mutex log_mutex;++ inline const char* level_name(LogLevel level) {+ switch (level) {+ case TRACE:+ return "TRACE";+ case DEBUG:+ return "DEBUG";+ case INFO:+ return "INFO";+ case WARN:+ return "WARN";+ case ERR:+ return "ERR";+ case CRIT:+ return "CRIT";+ default:+ return "";+ }+ }+template <typename... Args> void log(LogLevel level, const std::string& fmt, Args&&... args) {if (quiet && level < ERR) {@@ -27,40 +51,17 @@ namespace debug {}const auto now = std::chrono::system_clock::now();const auto t = std::chrono::system_clock::to_time_t(now);- const auto ms =- std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;+ const auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;std::tm tm{};localtime_r(&t, &tm);- std::cerr << '[' << std::put_time(&tm, "%F %T") << '.' << std::setfill('0') << std::setw(3)- << ms.count() << std::setfill(' ') << "] ";-- std::cerr << '[';-- switch (level) {- case TRACE:- std::cerr << "TRACE";- break;- case DEBUG:- std::cerr << "DEBUG";- break;- case INFO:- std::cerr << "INFO";- break;- case WARN:- std::cerr << "WARN";- break;- case ERR:- std::cerr << "ERR";- break;- case CRIT:- std::cerr << "CRIT";- break;- default:- break;- }- std::cerr << "] ";+ std::ostringstream line;+ line << '[' << std::put_time(&tm, "%F %T") << '.' << std::setfill('0') << std::setw(3) << ms.count()+ << std::setfill(' ') << "] ";+ line << '[' << level_name(level) << "] ";+ line << std::vformat(fmt, std::make_format_args(args...)) << '\n';- std::cerr << std::vformat(fmt, std::make_format_args(args...)) << std::endl;+ std::lock_guard<std::mutex> lock(log_mutex);+ std::cerr << line.str() << std::flush;}} // namespace debugdiff --git a/src/core/include/tether/net.hpp b/src/core/include/tether/net.hppindex 46b77c7..6f29b50 100644--- a/src/core/include/tether/net.hpp+++ b/src/core/include/tether/net.hpp@@ -37,6 +37,13 @@ namespace tether {nlohmann::json build_bt_status();nlohmann::json build_bt_devices();+ // Whether mDNS is usable (avahi-daemon is running). False until the+ // Avahi client reports otherwise. Setting it pushes an "mdns_status" event+ // to local subscribers.+ void set_mdns_available(bool available);+ bool mdns_available();+ nlohmann::json build_mdns_status();+class UnixServer {public:UnixServer(EpollEventLoop& loop);diff --git a/src/core/src/discovery.cpp b/src/core/src/discovery.cppindex efca26c..c604bac 100644--- a/src/core/src/discovery.cpp+++ b/src/core/src/discovery.cpp@@ -8,6 +8,7 @@#include <avahi-common/malloc.h>#include <avahi-common/simple-watch.h>#include <avahi-common/thread-watch.h>+#include <avahi-common/timeval.h>#include <algorithm>#include <chrono>@@ -24,11 +25,15 @@ namespace tether {// ─── Impl ───────────────────────────────────────────────────────// Defined at file scope so C-style Avahi callbacks can access it.+ // How long to wait before rebuilding a client whose daemon went away.+ static constexpr unsigned RECONNECT_DELAY_MS = 1000;+struct DiscoveryImpl {// Publishing stateAvahiThreadedPoll* pub_poll = nullptr;AvahiClient* pub_client = nullptr;AvahiEntryGroup* pub_group = nullptr;+ AvahiTimeout* pub_reconnect = nullptr;std::string pub_name;uint16_t pub_port = 0;std::string pub_fingerprint;@@ -41,13 +46,36 @@ namespace tether {AvahiThreadedPoll* browse_poll = nullptr;AvahiClient* browse_client = nullptr;AvahiServiceBrowser* browse_browser = nullptr;+ AvahiTimeout* browse_reconnect = nullptr;std::function<void(const std::vector<DiscoveredDevice>&)> browse_callback;void* browse_ctx = nullptr;++ // Availability reporting+ std::mutex state_mutex;+ Discovery::StateCallback state_callback;+ bool state_known = false;+ bool state_available = false;};// Wire the pimpl to use DiscoveryImplstruct Discovery::Impl : DiscoveryImpl {};+ // Reports availability, collapsing repeats. The publish and browse+ // clients use the same daemon and the same states+ static void report_state(DiscoveryImpl* impl, bool available) {+ Discovery::StateCallback cb;+ {+ std::lock_guard<std::mutex> lock(impl->state_mutex);+ if (impl->state_known && impl->state_available == available)+ return;+ impl->state_known = true;+ impl->state_available = available;+ cb = impl->state_callback;+ }+ if (cb)+ cb(available);+ }+// ─── Publishing callbacks ───────────────────────────────────────static void create_services(DiscoveryImpl* impl);@@ -135,6 +163,30 @@ namespace tether {}}+ static void pub_client_callback(AvahiClient* c, AvahiClientState state, void* userdata);++ // Rebuilds the publishing client after avahi-daemon went away.+ static void pub_reconnect_callback(AvahiTimeout* t, void* userdata) {+ auto* impl = static_cast<DiscoveryImpl*>(userdata);++ // The group belongs to the dead client and dies with it.+ impl->pub_group = nullptr;+ if (impl->pub_client) {+ avahi_client_free(impl->pub_client);+ impl->pub_client = nullptr;+ }++ int error = 0;+ impl->pub_client = avahi_client_new(+ avahi_threaded_poll_get(impl->pub_poll), AVAHI_CLIENT_NO_FAIL, pub_client_callback, impl, &error);+ if (!impl->pub_client) {+ debug::log(ERR, "mDNS: Failed to recreate client: {}", avahi_strerror(error));+ struct timeval tv;+ avahi_elapse_time(&tv, RECONNECT_DELAY_MS, 0);+ avahi_threaded_poll_get(impl->pub_poll)->timeout_update(t, &tv);+ }+ }+static void pub_client_callback(AvahiClient* c, AvahiClientState state, void* userdata) {auto* impl = static_cast<DiscoveryImpl*>(userdata);impl->pub_client = c;@@ -142,9 +194,20 @@ namespace tether {switch (state) {case AVAHI_CLIENT_S_RUNNING:create_services(impl);+ report_state(impl, true);+ break;+ case AVAHI_CLIENT_CONNECTING:+ debug::log(ERR, "mDNS: avahi-daemon is not running; waiting for it to start");+ report_state(impl, false);break;case AVAHI_CLIENT_FAILURE:debug::log(ERR, "mDNS: Client failure: {}", avahi_strerror(avahi_client_errno(c)));+ report_state(impl, false);+ if (avahi_client_errno(c) == AVAHI_ERR_DISCONNECTED && impl->pub_reconnect) {+ struct timeval tv;+ avahi_elapse_time(&tv, RECONNECT_DELAY_MS, 0);+ avahi_threaded_poll_get(impl->pub_poll)->timeout_update(impl->pub_reconnect, &tv);+ }break;case AVAHI_CLIENT_S_COLLISION:case AVAHI_CLIENT_S_REGISTERING:@@ -274,6 +337,109 @@ namespace tether {}}+ // ─── Continuous browse callbacks ────────────────────────────────++ static void browse_client_callback(AvahiClient* c, AvahiClientState state, void* userdata);++ // Counterpart of pub_reconnect_callback for the browsing client.+ static void browse_reconnect_callback(AvahiTimeout* t, void* userdata) {+ auto* impl = static_cast<DiscoveryImpl*>(userdata);++ if (impl->browse_client) {+ avahi_client_free(impl->browse_client);+ impl->browse_client = nullptr;+ }++ int error = 0;+ impl->browse_client = avahi_client_new(+ avahi_threaded_poll_get(impl->browse_poll), AVAHI_CLIENT_NO_FAIL, browse_client_callback, impl, &error);+ if (!impl->browse_client) {+ debug::log(ERR, "mDNS: Failed to recreate browse client: {}", avahi_strerror(error));+ struct timeval tv;+ avahi_elapse_time(&tv, RECONNECT_DELAY_MS, 0);+ avahi_threaded_poll_get(impl->browse_poll)->timeout_update(t, &tv);+ }+ }++ static void browse_client_callback(AvahiClient* c, AvahiClientState state, void* userdata) {+ auto* impl = static_cast<DiscoveryImpl*>(userdata);+ auto* ctx = static_cast<BrowseContext*>(impl->browse_ctx);+ impl->browse_client = c;+ if (ctx)+ ctx->client = c;++ switch (state) {+ case AVAHI_CLIENT_S_RUNNING:+ // The browser can only be created once the daemon is connected, so+ // it is built here rather than alongside the client.+ if (!impl->browse_browser && ctx) {+ impl->browse_browser = avahi_service_browser_new(c,+ AVAHI_IF_UNSPEC,+ AVAHI_PROTO_UNSPEC,+ SERVICE_TYPE,+ nullptr, // domain (default .local)+ (AvahiLookupFlags)0,+ browse_callback,+ ctx);+ if (!impl->browse_browser) {+ debug::log(ERR, "mDNS: Failed to create browser: {}", avahi_strerror(avahi_client_errno(c)));+ break;+ }+ }+ report_state(impl, true);+ break;+ case AVAHI_CLIENT_CONNECTING:+ report_state(impl, false);+ break;+ case AVAHI_CLIENT_FAILURE:+ debug::log(ERR, "mDNS: Browse client failure: {}", avahi_strerror(avahi_client_errno(c)));+ report_state(impl, false);+ // The browser belongs to the dead client; a new one is built when+ // the replacement client reaches S_RUNNING.+ impl->browse_browser = nullptr;+ {+ std::lock_guard<std::mutex> lock(impl->results_mutex);+ impl->results.clear();+ }+ if (avahi_client_errno(c) == AVAHI_ERR_DISCONNECTED && impl->browse_reconnect) {+ struct timeval tv;+ avahi_elapse_time(&tv, RECONNECT_DELAY_MS, 0);+ avahi_threaded_poll_get(impl->browse_poll)->timeout_update(impl->browse_reconnect, &tv);+ }+ break;+ default:+ break;+ }+ }++ // Per-call state for the one-shot discover(). The browser can only be built+ // once the daemon is connected, so the callback owns it.+ struct OneShotBrowse {+ BrowseContext ctx;+ AvahiServiceBrowser* browser = nullptr;+ };++ static void discover_client_callback(AvahiClient* c, AvahiClientState state, void* userdata) {+ auto* one = static_cast<OneShotBrowse*>(userdata);+ one->ctx.client = c;++ if (state == AVAHI_CLIENT_S_RUNNING && !one->browser) {+ one->browser = avahi_service_browser_new(c,+ AVAHI_IF_UNSPEC,+ AVAHI_PROTO_UNSPEC,+ SERVICE_TYPE,+ nullptr, // domain (default .local)+ (AvahiLookupFlags)0,+ browse_callback,+ &one->ctx);+ if (!one->browser)+ debug::log(ERR, "mDNS: Failed to create browser: {}", avahi_strerror(avahi_client_errno(c)));+ } else if (state == AVAHI_CLIENT_FAILURE) {+ debug::log(ERR, "mDNS: Browse client failure: {}", avahi_strerror(avahi_client_errno(c)));+ one->browser = nullptr;+ }+ }+// ─── Discovery class ────────────────────────────────────────────Discovery::Discovery() : impl_(std::make_unique<Impl>()) {}@@ -288,6 +454,11 @@ namespace tether {Discovery::Discovery(Discovery&&) noexcept = default;Discovery& Discovery::operator=(Discovery&&) noexcept = default;+ void Discovery::set_state_callback(StateCallback cb) {+ std::lock_guard<std::mutex> lock(impl_->state_mutex);+ impl_->state_callback = std::move(cb);+ }+bool Discovery::publish(const std::string& name, uint16_t port, const std::string& fingerprint) {unpublish();@@ -301,23 +472,29 @@ namespace tether {return false;}+ // Created disabled; armed only when the daemon disconnects. Allocating+ // it up front keeps the reconnect path free of allocation.+ const AvahiPoll* poll_api = avahi_threaded_poll_get(impl_->pub_poll);+ impl_->pub_reconnect = poll_api->timeout_new(poll_api, nullptr, pub_reconnect_callback, impl_.get());++ // NO_FAIL: register whenever avahi-daemon appears rather than only if+ // it happens to be up right now.int error = 0;- impl_->pub_client = avahi_client_new(- avahi_threaded_poll_get(impl_->pub_poll), (AvahiClientFlags)0, pub_client_callback, impl_.get(), &error);+ impl_->pub_client = avahi_client_new(poll_api, AVAHI_CLIENT_NO_FAIL, pub_client_callback, impl_.get(), &error);if (!impl_->pub_client) {+ // NO_FAIL covers an absent avahi-daemon, so reaching here means the+ // bus itself is unreachable: nothing to wait for.debug::log(ERR, "mDNS: Failed to create client: {}", avahi_strerror(error));- avahi_threaded_poll_free(impl_->pub_poll);- impl_->pub_poll = nullptr;+ unpublish();+ report_state(impl_.get(), false);return false;}if (avahi_threaded_poll_start(impl_->pub_poll) < 0) {debug::log(ERR, "mDNS: Failed to start threaded poll");- avahi_client_free(impl_->pub_client);- impl_->pub_client = nullptr;- avahi_threaded_poll_free(impl_->pub_poll);- impl_->pub_poll = nullptr;+ unpublish();+ report_state(impl_.get(), false);return false;}@@ -328,6 +505,10 @@ namespace tether {if (impl_->pub_poll) {avahi_threaded_poll_stop(impl_->pub_poll);}+ if (impl_->pub_reconnect) {+ avahi_threaded_poll_get(impl_->pub_poll)->timeout_free(impl_->pub_reconnect);+ impl_->pub_reconnect = nullptr;+ }if (impl_->pub_group) {avahi_entry_group_free(impl_->pub_group);impl_->pub_group = nullptr;@@ -355,13 +536,11 @@ namespace tether {impl_->results.clear();}+ OneShotBrowse one{{impl_.get(), nullptr}, nullptr};+int error = 0;AvahiClient* client = avahi_client_new(- avahi_threaded_poll_get(poll),- (AvahiClientFlags)0,- [](AvahiClient*, AvahiClientState, void*) {}, // no-op callback- nullptr,- &error);+ avahi_threaded_poll_get(poll), AVAHI_CLIENT_NO_FAIL, discover_client_callback, &one, &error);if (!client) {debug::log(ERR, "mDNS: Failed to create browse client: {}", avahi_strerror(error));@@ -369,30 +548,14 @@ namespace tether {return {};}- BrowseContext ctx{impl_.get(), client};-- AvahiServiceBrowser* browser = avahi_service_browser_new(client,- AVAHI_IF_UNSPEC,- AVAHI_PROTO_UNSPEC,- SERVICE_TYPE,- nullptr, // domain (default .local)- (AvahiLookupFlags)0,- browse_callback,- &ctx);-- if (!browser) {- debug::log(ERR, "mDNS: Failed to create browser: {}", avahi_strerror(avahi_client_errno(client)));- avahi_client_free(client);- avahi_threaded_poll_free(poll);- return {};- }-- // Run the browse loop for the requested duration+ // Run the browse loop for the requested duration. With NO_FAIL the scan+ // still covers a daemon that only becomes available partway through.avahi_threaded_poll_start(poll);std::this_thread::sleep_for(std::chrono::milliseconds(timeout_ms));avahi_threaded_poll_stop(poll);- avahi_service_browser_free(browser);+ if (one.browser)+ avahi_service_browser_free(one.browser);avahi_client_free(client);avahi_threaded_poll_free(poll);@@ -416,42 +579,19 @@ namespace tether {return;}+ impl_->browse_ctx = new BrowseContext{impl_.get(), nullptr};++ const AvahiPoll* poll_api = avahi_threaded_poll_get(impl_->browse_poll);+ impl_->browse_reconnect = poll_api->timeout_new(poll_api, nullptr, browse_reconnect_callback, impl_.get());+int error = 0;- impl_->browse_client = avahi_client_new(- avahi_threaded_poll_get(impl_->browse_poll),- (AvahiClientFlags)0,- [](AvahiClient*, AvahiClientState, void*) {},- nullptr,- &error);+ impl_->browse_client =+ avahi_client_new(poll_api, AVAHI_CLIENT_NO_FAIL, browse_client_callback, impl_.get(), &error);if (!impl_->browse_client) {debug::log(ERR, "mDNS: Failed to create browse client: {}", avahi_strerror(error));- avahi_threaded_poll_free(impl_->browse_poll);- impl_->browse_poll = nullptr;- return;- }-- // Allocate a dedicated context- auto* ctx = new BrowseContext{impl_.get(), impl_->browse_client};- impl_->browse_ctx = ctx;-- impl_->browse_browser = avahi_service_browser_new(impl_->browse_client,- AVAHI_IF_UNSPEC,- AVAHI_PROTO_UNSPEC,- SERVICE_TYPE,- nullptr,- (AvahiLookupFlags)0,- browse_callback,- ctx);-- if (!impl_->browse_browser) {- debug::log(- ERR, "mDNS: Failed to create browser: {}", avahi_strerror(avahi_client_errno(impl_->browse_client)));- avahi_client_free(impl_->browse_client);- avahi_threaded_poll_free(impl_->browse_poll);- impl_->browse_client = nullptr;- impl_->browse_poll = nullptr;- delete ctx;+ stop_continuous_browse();+ report_state(impl_.get(), false);return;}@@ -466,6 +606,11 @@ namespace tether {impl_->browse_callback = nullptr;+ if (impl_->browse_reconnect) {+ avahi_threaded_poll_get(impl_->browse_poll)->timeout_free(impl_->browse_reconnect);+ impl_->browse_reconnect = nullptr;+ }+if (impl_->browse_browser)avahi_service_browser_free(impl_->browse_browser);if (impl_->browse_client)diff --git a/src/core/src/net.cpp b/src/core/src/net.cppindex c3016ae..f2a6334 100644--- a/src/core/src/net.cpp+++ b/src/core/src/net.cpp@@ -299,6 +299,24 @@ namespace tether {return status;}+ static std::atomic<bool> g_mdns_available{false};++ bool mdns_available() { return g_mdns_available.load(); }++ nlohmann::json build_mdns_status() {+ return nlohmann::json{{"command", "mdns_status"}, {"available", g_mdns_available.load()}};+ }++ void set_mdns_available(bool available) {+ if (g_mdns_available.exchange(available) == available)+ return;+ if (available)+ debug::log(INFO, "mDNS: avahi-daemon is available");+ else+ debug::log(ERR, "mDNS: avahi-daemon is unavailable; this machine cannot be discovered");+ broadcast_local_event(build_mdns_status().dump());+ }+// Guards against two pairing transactions racing for the same agent and// advertisement object paths.static std::atomic<bool> g_bt_pair_busy{false};@@ -543,6 +561,8 @@ namespace tether {snapshot["recent_received_files"].push_back(item);}+ snapshot["mdns_available"] = g_mdns_available.load();+return snapshot;}diff --git a/src/daemon/main.cpp b/src/daemon/main.cppindex ffad2c7..aeb74be 100644--- a/src/daemon/main.cpp+++ b/src/daemon/main.cpp@@ -4,6 +4,7 @@#include <ctime>#include <mutex>#include <nlohmann/json.hpp>+#include <sys/timerfd.h>#include <tether/bluetooth/config.hpp>#include <tether/bluetooth/connection.hpp>#include <tether/bluetooth/contacts.hpp>@@ -88,9 +89,9 @@ int main(int argc, char** argv) {char hostname[256] = {};gethostname(hostname, sizeof(hostname) - 1);std::string my_fp = tether::Crypto::instance().get_my_fingerprint();- if (!discovery.publish(hostname, 5134, my_fp)) {- debug::log(ERR, "Warning: mDNS advertisement failed (is avahi-daemon running?)");- }++ discovery.set_state_callback([](bool available) { tether::set_mdns_available(available); });+ discovery.publish(hostname, 5134, my_fp);discovery.start_continuous_browse([](const std::vector<tether::DiscoveredDevice>& devices) {nlohmann::json payload;@@ -128,7 +129,8 @@ int main(int argc, char** argv) {tether::FileReceiveManager file_mgr;tether::DesktopNotifier notifier;- if (!notifier.init()) {+ const bool notifier_ready = notifier.init();+ if (!notifier_ready) {debug::log(ERR, "Warning: desktop notifications unavailable");} else {file_mgr.set_on_complete([¬ifier](const std::filesystem::path& path, size_t bytes_written) {@@ -138,6 +140,32 @@ int main(int argc, char** argv) {}tether::g_file_manager = &file_mgr;+ if (notifier_ready) {+ int mdns_warn_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);+ if (mdns_warn_fd >= 0) {+ itimerspec spec{};+ spec.it_value.tv_sec = 15;+ timerfd_settime(mdns_warn_fd, 0, &spec, nullptr);+ loop.addFd(mdns_warn_fd, [&loop, ¬ifier](int fd) {+ uint64_t ticks = 0;+ ssize_t ignored = read(fd, &ticks, sizeof(ticks));+ (void)ignored;+ loop.removeFd(fd);+ close(fd);+ if (tether::mdns_available())+ return;+ debug::log(ERR, "mDNS: still unavailable after 15s; notifying the user");+ notifier.notify({_("Tether"),+ _("This PC can't be discovered"),+ _("avahi-daemon isn't running, so Tether can't advertise itself on the "+ "network. Start it with: sudo systemctl enable --now avahi-daemon"),+ {"network-wireless-offline", "network-offline", "dialog-warning"},+ false,+ ""});+ });+ }+ }+// BlueZ runs on its own GLib thread and wakes the loop through an eventfd// whenever the adapter or device set changes.tether::bluetooth::BluezMonitor bluez;diff --git a/src/gtk/devices_view.cpp b/src/gtk/devices_view.cppindex 9667a99..da3d2e1 100644--- a/src/gtk/devices_view.cpp+++ b/src/gtk/devices_view.cpp@@ -21,6 +21,9 @@ namespace tether::ui {std::vector<std::pair<std::string, std::string>> paired_devices; // fp, namestd::vector<std::string> connected_fps; // active connections+ // false when avahi-daemon is down+ bool mdns_ok = true;+// The Bluetooth routestd::vector<nlohmann::json> bt_devices;nlohmann::json bt_status = nlohmann::json::object();@@ -534,13 +537,24 @@ namespace tether::ui {void update_wifi_indicator() {const bool connected = !g_devices.connected_fps.empty();- set_route_status(Route::WiFi,- connected,- connected ? _("Clipboard, files, and OTP are connected.")- : _("No paired iPhone is connected. Open the Tether app on the phone."));+ if (connected) {+ set_route_status(Route::WiFi, true, _("Clipboard, files, and OTP are connected."));+ return;+ }++ if (!g_devices.mdns_ok) {+ set_route_status(Route::WiFi,+ false,+ _("avahi-daemon isn't running, so the iPhone can't find this PC. Start it "+ "with: sudo systemctl enable --now avahi-daemon"));+ return;+ }+ set_route_status(Route::WiFi, false, _("No paired iPhone is connected. Open the Tether app on the phone."));}void apply_state_snapshot(const nlohmann::json& j) {++ g_devices.mdns_ok = j.value("mdns_available", true);g_devices.connected_fps.clear();if (j.contains("connected_clients") && j["connected_clients"].is_array()) {for (auto& c : j["connected_clients"]) {@@ -787,6 +801,11 @@ namespace tether::ui {apply_state_snapshot(event);return true;}+ if (command == "mdns_status") {+ g_devices.mdns_ok = event.value("available", true);+ update_wifi_indicator();+ return true;+ }if (command == "client_connected") {std::string fp = event.value("fingerprint", "");if (std::find(g_devices.connected_fps.begin(), g_devices.connected_fps.end(), fp) ==diff --git a/test/CMakeLists.txt b/test/CMakeLists.txtindex bf0490e..8242a70 100644--- a/test/CMakeLists.txt+++ b/test/CMakeLists.txt@@ -16,6 +16,7 @@ add_executable(tether_testtest_discovery.cpptest_display_width.cpptest_file_transfer.cpp+ test_log.cpptest_otp.cpptest_message_format.cpp../src/gtk/message_format.cppdiff --git a/test/test_discovery.cpp b/test/test_discovery.cppindex 505d9a2..3e4405b 100644--- a/test/test_discovery.cpp+++ b/test/test_discovery.cpp@@ -1,7 +1,10 @@#include <gtest/gtest.h>#include <tether/discovery.hpp>-#include <vector>+#include <chrono>+#include <mutex>#include <string>+#include <thread>+#include <vector>TEST(DiscoveryTest, GroupDiscoveredHosts_EmptyInput) {std::vector<tether::DiscoveredHost> hosts;@@ -82,4 +85,28 @@ TEST(DiscoveryTest, GroupDiscoveredHosts_MixedFingerprintsAndNames) {};auto result = tether::group_discovered_hosts(hosts);ASSERT_EQ(result.size(), 2);-}\ No newline at end of file+}++// Publishing and continuous browse both watch the same daemon and each walks+// the same client states, so the availability report must collapse repeats:+// consecutive identical values would flap the UI indicator.+TEST(DiscoveryTest, StateCallbackReportsOnlyChanges) {+ tether::Discovery discovery;++ std::mutex mutex;+ std::vector<bool> reports;+ discovery.set_state_callback([&](bool available) {+ std::lock_guard<std::mutex> lock(mutex);+ reports.push_back(available);+ });++ discovery.publish("tether-test", 5134, "testfingerprint");+ discovery.start_continuous_browse([](const std::vector<tether::DiscoveredDevice>&) {});+ std::this_thread::sleep_for(std::chrono::milliseconds(500));++ std::lock_guard<std::mutex> lock(mutex);+ ASSERT_FALSE(reports.empty()) << "availability was never reported";+ for (size_t i = 1; i < reports.size(); ++i) {+ EXPECT_NE(reports[i], reports[i - 1]) << "duplicate report at index " << i;+ }+}diff --git a/test/test_log.cpp b/test/test_log.cppnew file mode 100644index 0000000..2a41a72--- /dev/null+++ b/test/test_log.cpp@@ -0,0 +1,40 @@+#include <gtest/gtest.h>+#include <iostream>+#include <regex>+#include <sstream>+#include <string>+#include <tether/log.hpp>+#include <thread>+#include <vector>++// The daemon logs from several threads at once. Every line must arrive whole:+// a line assembled from separate stream inserters interleaves mid-line.+TEST(LogTest, ConcurrentLinesAreNotInterleaved) {+ constexpr int threads = 8;+ constexpr int lines_per_thread = 200;++ std::ostringstream captured;+ std::streambuf* previous = std::cerr.rdbuf(captured.rdbuf());++ std::vector<std::thread> workers;+ for (int t = 0; t < threads; ++t) {+ workers.emplace_back([t] {+ for (int i = 0; i < lines_per_thread; ++i)+ debug::log(INFO, "thread {} line {}", t, i);+ });+ }+ for (auto& worker : workers)+ worker.join();++ std::cerr.rdbuf(previous);++ const std::regex expected(R"(^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\] \[INFO\] thread \d+ line \d+$)");+ std::istringstream stream(captured.str());+ std::string line;+ int count = 0;+ while (std::getline(stream, line)) {+ ++count;+ EXPECT_TRUE(std::regex_match(line, expected)) << "torn line: " << line;+ }+ EXPECT_EQ(count, threads * lines_per_thread);+}