mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-15 00:34:05 +09:00
add error message if dnssd_register_airplay or _raop fails
This commit is contained in:
30
README.html
30
README.html
@@ -823,18 +823,28 @@ correct one; on 64-bit Ubuntu, this is done by running
|
||||
<code>export OPENSSL_ROOT_DIR=/usr/lib/X86_64-linux-gnu/</code> before
|
||||
running cmake.</p>
|
||||
<h3
|
||||
id="uxplay-starts-but-stalls-after-initialized-server-sockets-appears-without-any-server-name-showing-on-the-client.">1.
|
||||
uxplay starts, but stalls after “Initialized server socket(s)” appears,
|
||||
<em>without any server name showing on the client</em>.</h3>
|
||||
id="uxplay-starts-but-stalls-or-stops-after-initialized-server-sockets-appears-without-any-server-name-showing-on-the-client.">1.
|
||||
uxplay starts, but stalls or stops after “Initialized server socket(s)”
|
||||
appears, <em>without any server name showing on the client</em>.</h3>
|
||||
<p>Stalling this way, with <em>no</em> server name showing <em>on the
|
||||
client</em> as available, probably means that your network <strong>does
|
||||
not have a running Bonjour/zeroconf DNS-SD server.</strong> On Linux,
|
||||
make sure Avahi is installed, and start the avahi-daemon service on the
|
||||
system running uxplay (your distribution will document how to do this).
|
||||
Some systems may instead use the mdnsd daemon as an alternative to
|
||||
provide DNS-SD service. <em>(FreeBSD offers both alternatives, but only
|
||||
Avahi was tested: one of the steps needed for getting Avahi running on a
|
||||
FreeBSD system is to edit
|
||||
not have a running Bonjour/zeroconf DNS-SD server.</strong></p>
|
||||
<p>UxPlay used to stall silently if DNS-SD service registration failed,
|
||||
but now stops with an error message returned by the DNSServiceRegister
|
||||
function, which will probably be -65537 (0xFFFE FFFF, or
|
||||
kDNSServiceErr_Unknown) if no DNS-SD server was found: mDNS error codes
|
||||
are in the range FFFE FF00 (-65792) to FFFE FFFF (-65537), and are
|
||||
listed in Apple’s dnssd.h file. An older version of this (the one used
|
||||
by avahi) is found <a
|
||||
href="https://github.com/lathiat/avahi/blob/master/avahi-compat-libdns_sd/dns_sd.h">here</a>.
|
||||
A few additional error codes are defined in a later version from <a
|
||||
href="https://opensource.apple.com/source/mDNSResponder/mDNSResponder-544/mDNSShared/dns_sd.h.auto.html">Apple</a>.</p>
|
||||
<p>On Linux, make sure Avahi is installed, and start the avahi-daemon
|
||||
service on the system running uxplay (your distribution will document
|
||||
how to do this). Some systems may instead use the mdnsd daemon as an
|
||||
alternative to provide DNS-SD service. <em>(FreeBSD offers both
|
||||
alternatives, but only Avahi was tested: one of the steps needed for
|
||||
getting Avahi running on a FreeBSD system is to edit
|
||||
<code>/usr/local/etc/avahi/avahi-daemon.conf</code> to uncomment a line
|
||||
for airplay support.</em>)</p>
|
||||
<p>After starting uxplay, use the utility
|
||||
|
||||
10
README.md
10
README.md
@@ -692,10 +692,18 @@ Solution: when more than one installation of OpenSSL is present, set the environ
|
||||
on 64-bit Ubuntu, this is done by
|
||||
running `export OPENSSL_ROOT_DIR=/usr/lib/X86_64-linux-gnu/` before running cmake.
|
||||
|
||||
### 1. uxplay starts, but stalls after "Initialized server socket(s)" appears, *without any server name showing on the client*.
|
||||
### 1. uxplay starts, but stalls or stops after "Initialized server socket(s)" appears, *without any server name showing on the client*.
|
||||
|
||||
Stalling this way, with _no_ server name showing _on the client_ as available,
|
||||
probably means that your network **does not have a running Bonjour/zeroconf DNS-SD server.**
|
||||
|
||||
UxPlay used to stall silently if DNS-SD service registration failed, but now stops with an error message returned by the
|
||||
DNSServiceRegister function, which will probably be -65537 (0xFFFE FFFF, or kDNSServiceErr_Unknown) if no DNS-SD server was found:
|
||||
mDNS error codes are in the range FFFE FF00 (-65792) to FFFE FFFF (-65537), and are listed in Apple's
|
||||
dnssd.h file. An older version of this (the one used by avahi) is found [here](https://github.com/lathiat/avahi/blob/master/avahi-compat-libdns_sd/dns_sd.h).
|
||||
A few additional error codes are defined in a later version
|
||||
from [Apple](https://opensource.apple.com/source/mDNSResponder/mDNSResponder-544/mDNSShared/dns_sd.h.auto.html).
|
||||
|
||||
On Linux, make sure Avahi is installed,
|
||||
and start the avahi-daemon service on the system running uxplay (your distribution will document how to do this).
|
||||
Some systems may instead use the mdnsd daemon as an alternative to provide DNS-SD service.
|
||||
|
||||
31
README.txt
31
README.txt
@@ -844,18 +844,31 @@ correct one; on 64-bit Ubuntu, this is done by running
|
||||
`export OPENSSL_ROOT_DIR=/usr/lib/X86_64-linux-gnu/` before running
|
||||
cmake.
|
||||
|
||||
### 1. uxplay starts, but stalls after "Initialized server socket(s)" appears, *without any server name showing on the client*.
|
||||
### 1. uxplay starts, but stalls or stops after "Initialized server socket(s)" appears, *without any server name showing on the client*.
|
||||
|
||||
Stalling this way, with *no* server name showing *on the client* as
|
||||
available, probably means that your network **does not have a running
|
||||
Bonjour/zeroconf DNS-SD server.** On Linux, make sure Avahi is
|
||||
installed, and start the avahi-daemon service on the system running
|
||||
uxplay (your distribution will document how to do this). Some systems
|
||||
may instead use the mdnsd daemon as an alternative to provide DNS-SD
|
||||
service. *(FreeBSD offers both alternatives, but only Avahi was tested:
|
||||
one of the steps needed for getting Avahi running on a FreeBSD system is
|
||||
to edit `/usr/local/etc/avahi/avahi-daemon.conf` to uncomment a line for
|
||||
airplay support.*)
|
||||
Bonjour/zeroconf DNS-SD server.**
|
||||
|
||||
UxPlay used to stall silently if DNS-SD service registration failed, but
|
||||
now stops with an error message returned by the DNSServiceRegister
|
||||
function, which will probably be -65537 (0xFFFE FFFF, or
|
||||
kDNSServiceErr_Unknown) if no DNS-SD server was found: mDNS error codes
|
||||
are in the range FFFE FF00 (-65792) to FFFE FFFF (-65537), and are
|
||||
listed in Apple's dnssd.h file. An older version of this (the one used
|
||||
by avahi) is found
|
||||
[here](https://github.com/lathiat/avahi/blob/master/avahi-compat-libdns_sd/dns_sd.h).
|
||||
A few additional error codes are defined in a later version from
|
||||
[Apple](https://opensource.apple.com/source/mDNSResponder/mDNSResponder-544/mDNSShared/dns_sd.h.auto.html).
|
||||
|
||||
On Linux, make sure Avahi is installed, and start the avahi-daemon
|
||||
service on the system running uxplay (your distribution will document
|
||||
how to do this). Some systems may instead use the mdnsd daemon as an
|
||||
alternative to provide DNS-SD service. *(FreeBSD offers both
|
||||
alternatives, but only Avahi was tested: one of the steps needed for
|
||||
getting Avahi running on a FreeBSD system is to edit
|
||||
`/usr/local/etc/avahi/avahi-daemon.conf` to uncomment a line for airplay
|
||||
support.*)
|
||||
|
||||
After starting uxplay, use the utility `avahi-browse -a -t` in a
|
||||
different terminal window on the server to verify that the UxPlay
|
||||
|
||||
11
lib/dnssd.c
11
lib/dnssd.c
@@ -255,6 +255,7 @@ int
|
||||
dnssd_register_raop(dnssd_t *dnssd, unsigned short port)
|
||||
{
|
||||
char servname[MAX_SERVNAME];
|
||||
DNSServiceErrorType retval;
|
||||
|
||||
assert(dnssd);
|
||||
|
||||
@@ -295,7 +296,7 @@ dnssd_register_raop(dnssd_t *dnssd, unsigned short port)
|
||||
strncat(servname, dnssd->name, sizeof(servname)-strlen(servname)-1);
|
||||
|
||||
/* Register the service */
|
||||
dnssd->DNSServiceRegister(&dnssd->raop_service, 0, 0,
|
||||
retval = dnssd->DNSServiceRegister(&dnssd->raop_service, 0, 0,
|
||||
servname, "_raop._tcp",
|
||||
NULL, NULL,
|
||||
htons(port),
|
||||
@@ -303,14 +304,14 @@ dnssd_register_raop(dnssd_t *dnssd, unsigned short port)
|
||||
dnssd->TXTRecordGetBytesPtr(&dnssd->raop_record),
|
||||
NULL, NULL);
|
||||
|
||||
|
||||
return 1;
|
||||
return (int) retval; /* error codes are listed in Apple's dns_sd.h */
|
||||
}
|
||||
|
||||
int
|
||||
dnssd_register_airplay(dnssd_t *dnssd, unsigned short port)
|
||||
{
|
||||
char device_id[3 * MAX_HWADDR_LEN];
|
||||
DNSServiceErrorType retval;
|
||||
|
||||
assert(dnssd);
|
||||
|
||||
@@ -332,7 +333,7 @@ dnssd_register_airplay(dnssd_t *dnssd, unsigned short port)
|
||||
dnssd->TXTRecordSetValue(&dnssd->airplay_record, "vv", strlen(AIRPLAY_VV), AIRPLAY_VV);
|
||||
|
||||
/* Register the service */
|
||||
dnssd->DNSServiceRegister(&dnssd->airplay_service, 0, 0,
|
||||
retval = dnssd->DNSServiceRegister(&dnssd->airplay_service, 0, 0,
|
||||
dnssd->name, "_airplay._tcp",
|
||||
NULL, NULL,
|
||||
htons(port),
|
||||
@@ -340,7 +341,7 @@ dnssd_register_airplay(dnssd_t *dnssd, unsigned short port)
|
||||
dnssd->TXTRecordGetBytesPtr(&dnssd->airplay_record),
|
||||
NULL, NULL);
|
||||
|
||||
return 1;
|
||||
return (int) retval; /* error codes are listed in Apple's dns_sd.h */
|
||||
}
|
||||
|
||||
const char *
|
||||
|
||||
28
uxplay.cpp
28
uxplay.cpp
@@ -1260,6 +1260,7 @@ extern "C" void log_callback (void *cls, int level, const char *msg) {
|
||||
|
||||
int start_raop_server (std::vector<char> hw_addr, std::string name, unsigned short display[5],
|
||||
unsigned short tcp[3], unsigned short udp[3], bool debug_log) {
|
||||
int dnssd_error;
|
||||
raop_callbacks_t raop_cbs;
|
||||
memset(&raop_cbs, 0, sizeof(raop_cbs));
|
||||
raop_cbs.conn_init = conn_init;
|
||||
@@ -1306,9 +1307,8 @@ int start_raop_server (std::vector<char> hw_addr, std::string name, unsigned sho
|
||||
raop_start(raop, &port);
|
||||
raop_set_port(raop, port);
|
||||
|
||||
int error;
|
||||
dnssd = dnssd_init(name.c_str(), strlen(name.c_str()), hw_addr.data(), hw_addr.size(), &error);
|
||||
if (error) {
|
||||
dnssd = dnssd_init(name.c_str(), strlen(name.c_str()), hw_addr.data(), hw_addr.size(), &dnssd_error);
|
||||
if (dnssd_error) {
|
||||
LOGE("Could not initialize dnssd library!");
|
||||
stop_raop_server();
|
||||
return -2;
|
||||
@@ -1316,13 +1316,29 @@ int start_raop_server (std::vector<char> hw_addr, std::string name, unsigned sho
|
||||
|
||||
raop_set_dnssd(raop, dnssd);
|
||||
|
||||
dnssd_register_raop(dnssd, port);
|
||||
if ((dnssd_error = dnssd_register_raop(dnssd, port))) {
|
||||
if (dnssd_error == -65537) {
|
||||
LOGE("No DNS-SD Server found (DNSServiceRegister call returned kDNSServiceErr_Unknown)");
|
||||
} else {
|
||||
LOGE("dnssd_register_raop failed with error code %d\n"
|
||||
"mDNS Error codes are in range FFFE FF00 (-65792) to FFFE FFFF (-65537) "
|
||||
"(see Apple's dns_sd.h)", dnssd_error);
|
||||
}
|
||||
stop_raop_server();
|
||||
return -3;
|
||||
}
|
||||
if (tcp[2]) {
|
||||
port = tcp[2];
|
||||
} else {
|
||||
port = (port != HIGHEST_PORT ? port + 1 : port - 1);
|
||||
port = (port != HIGHEST_PORT ? port + 1 : port - 1);
|
||||
}
|
||||
if ((dnssd_error = dnssd_register_airplay(dnssd, port))) {
|
||||
LOGE("dnssd_register_airplay failed with error code %d\n"
|
||||
"mDNS Error codes are in range FFFE FF00 (-65792) to FFFE FFFF (-65537) "
|
||||
"(see Apple's dns_sd.h)", dnssd_error);
|
||||
stop_raop_server();
|
||||
return -4;
|
||||
}
|
||||
dnssd_register_airplay(dnssd, port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user