Skip to content

Commit

Permalink
Merge pull request xbmc#24890 from joseluismarti/service-names
Browse files Browse the repository at this point in the history
Use unique service names in Zeroconf registration
  • Loading branch information
fuzzard authored Mar 26, 2024
2 parents 2af8348 + bfc4084 commit e70f0d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion xbmc/network/AirTunesServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ bool CAirTunesServer::StartServer(int port, bool nonlocal, bool usePassword, con
txt.emplace_back("am", "Kodi,1");
txt.emplace_back("vs", "130.14");

CZeroconf::GetInstance()->PublishService("servers.airtunes", "_raop._tcp", appName, port, txt);
CZeroconf::GetInstance()->PublishService("servers.airtunes", "_raop._tcp",
CSysInfo::GetDeviceName() + " airtunes", port, txt);
}

return success;
Expand Down
10 changes: 4 additions & 6 deletions xbmc/network/EventServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ void CEventServer::Run()
}

// publish service
std::vector<std::pair<std::string, std::string> > txt;
CZeroconf::GetInstance()->PublishService("servers.eventserver",
"_xbmc-events._udp",
CSysInfo::GetDeviceName(),
m_iPort,
txt);
std::vector<std::pair<std::string, std::string>> txt;
CZeroconf::GetInstance()->PublishService("servers.eventserver", "_xbmc-events._udp",
CSysInfo::GetDeviceName() + " eventserver", m_iPort,
txt);

// add our socket to the 'select' listener
listener.AddSocket(m_pSocket.get());
Expand Down
13 changes: 9 additions & 4 deletions xbmc/network/NetworkServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,12 @@ bool CNetworkServices::StartWebserver()

// publish web frontend and API services
#ifdef HAS_WEB_INTERFACE
CZeroconf::GetInstance()->PublishService("servers.webserver", "_http._tcp", CSysInfo::GetDeviceName(), webPort, txt);
CZeroconf::GetInstance()->PublishService("servers.webserver", "_http._tcp",
CSysInfo::GetDeviceName() + " webserver", webPort, txt);
#endif // HAS_WEB_INTERFACE
CZeroconf::GetInstance()->PublishService("servers.jsonrpc-http", "_xbmc-jsonrpc-h._tcp", CSysInfo::GetDeviceName(), webPort, txt);
CZeroconf::GetInstance()->PublishService("servers.jsonrpc-http", "_xbmc-jsonrpc-h._tcp",
CSysInfo::GetDeviceName() + " jsonrpc-http", webPort,
txt);
#endif // HAS_ZEROCONF

return true;
Expand Down Expand Up @@ -785,7 +788,9 @@ bool CNetworkServices::StartAirPlayServer()
// we have implemented it anyways).
txt.emplace_back("features", "0x20F7");

CZeroconf::GetInstance()->PublishService("servers.airplay", "_airplay._tcp", CSysInfo::GetDeviceName(), CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_airPlayPort, txt);
CZeroconf::GetInstance()->PublishService(
"servers.airplay", "_airplay._tcp", CSysInfo::GetDeviceName() + " airplay",
CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_airPlayPort, txt);
#endif // HAS_ZEROCONF

return true;
Expand Down Expand Up @@ -878,7 +883,7 @@ bool CNetworkServices::StartJSONRPCServer()
CSettings::SETTING_SERVICES_DEVICEUUID));

CZeroconf::GetInstance()->PublishService(
"servers.jsonrpc-tcp", "_xbmc-jsonrpc._tcp", CSysInfo::GetDeviceName(),
"servers.jsonrpc-tcp", "_xbmc-jsonrpc._tcp", CSysInfo::GetDeviceName() + " jsonrpc-tcp",
CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_jsonTcpPort, txt);
#endif // HAS_ZEROCONF

Expand Down

0 comments on commit e70f0d8

Please sign in to comment.