diff --git a/app/src/streaming/GameStreamClient.cpp b/app/src/streaming/GameStreamClient.cpp index d71ad79f..3efae910 100644 --- a/app/src/streaming/GameStreamClient.cpp +++ b/app/src/streaming/GameStreamClient.cpp @@ -404,6 +404,14 @@ void GameStreamClient::find_hosts(ServerCallback>& callback) { int sock = mdns_socket_open_ipv4(nullptr); if (sock < 0) { + brls::sync([callback, generation] { + if (generation != findHostsGeneration.load()) { + return; + } + + callback(GSResult>::failure( + "discovery_manager/no_ip"_i18n)); + }); return; } @@ -457,8 +465,6 @@ void GameStreamClient::find_hosts(ServerCallback>& callback) { if (status == GS_OK) { Host host; host.address = searchContext.foundHost; - host.remoteAddress = - GameStreamClient::external_address_for_mdns(host.address); host.hostname = server_data.hostname; host.mac = server_data.mac; merge_discovered_host(foundHosts, host); @@ -482,6 +488,17 @@ void GameStreamClient::find_hosts(ServerCallback>& callback) { retro_sleep(500); } + if (!isCancelled() && foundHosts.empty()) { + brls::sync([callback, generation] { + if (generation != findHostsGeneration.load()) { + return; + } + + callback(GSResult>::failure( + "discovery_manager/no_host"_i18n)); + }); + } + closeSocket(); }); }