Add option to configure auto discovery(mDNS)

resolves #539
potentially resolves #611
This commit is contained in:
Yukino Song
2025-04-15 00:11:29 +08:00
parent 26b8446ba1
commit 56646c2a81
7 changed files with 19 additions and 1 deletions

View File

@@ -580,6 +580,7 @@ namespace config {
sunshine_t sunshine {
false, // hide_tray_controls
true, // enable_pairing
true, // enable_discovery
"en", // locale
2, // min_log_level
0, // flags
@@ -1280,6 +1281,7 @@ namespace config {
bool_f(vars, "hide_tray_controls", sunshine.hide_tray_controls);
bool_f(vars, "enable_pairing", sunshine.enable_pairing);
bool_f(vars, "enable_discovery", sunshine.enable_discovery);
bool_f(vars, "notify_pre_releases", sunshine.notify_pre_releases);
int port = sunshine.port;

View File

@@ -254,6 +254,7 @@ namespace config {
struct sunshine_t {
bool hide_tray_controls;
bool enable_pairing;
bool enable_discovery;
std::string locale;
int min_log_level;
std::bitset<flag::FLAG_SIZE> flags;

View File

@@ -325,7 +325,9 @@ int main(int argc, char *argv[]) {
std::unique_ptr<platf::deinit_t> mDNS;
auto sync_mDNS = std::async(std::launch::async, [&mDNS]() {
mDNS = platf::publish::start();
if (config::sunshine.enable_discovery) {
mDNS = platf::publish::start();
}
});
std::unique_ptr<platf::deinit_t> upnp_unmap;