mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-22 11:35:43 -04:00
Finally _really_ fixed OSX advertisements via rendezvous
This commit is contained in:
parent
0c50a31874
commit
90d3cd8929
@ -29,6 +29,8 @@ case $host in
|
|||||||
CPPFLAGS="$CPPFLAGS -DHAVE_SOCKLEN_T"; LDFLAGS="$LDFLAGS -lefence";;
|
CPPFLAGS="$CPPFLAGS -DHAVE_SOCKLEN_T"; LDFLAGS="$LDFLAGS -lefence";;
|
||||||
*darwin*)
|
*darwin*)
|
||||||
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -DHAVE_SOCKADDR_SA_LEN -DHAVE_SOCKLEN_T"
|
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -DHAVE_SOCKADDR_SA_LEN -DHAVE_SOCKLEN_T"
|
||||||
|
LDFLAGS="$LDFLAGS -framework CoreFoundation"
|
||||||
|
|
||||||
AM_CONDITIONAL(COND_REND_OSX,true)
|
AM_CONDITIONAL(COND_REND_OSX,true)
|
||||||
AM_CONDITIONAL(COND_REND_HOWL,false)
|
AM_CONDITIONAL(COND_REND_HOWL,false)
|
||||||
AM_CONDITIONAL(COND_REND_POSIX,false);;
|
AM_CONDITIONAL(COND_REND_POSIX,false);;
|
||||||
|
@ -10,9 +10,11 @@
|
|||||||
|
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
|
|
||||||
|
CFRunLoopRef rend_runloop;
|
||||||
|
|
||||||
|
|
||||||
static void rend_stoprunloop(void) {
|
static void rend_stoprunloop(void) {
|
||||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
CFRunLoopStop(rend_runloop);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rend_sigint(int sigraised) {
|
static void rend_sigint(int sigraised) {
|
||||||
@ -64,31 +66,37 @@ static void rend_reply(DNSServiceRegistrationReplyErrorType errorCode, void *con
|
|||||||
int rend_init(pid_t *pid, char *name, int port) {
|
int rend_init(pid_t *pid, char *name, int port) {
|
||||||
dns_service_discovery_ref daap_ref=NULL;
|
dns_service_discovery_ref daap_ref=NULL;
|
||||||
dns_service_discovery_ref http_ref=NULL;
|
dns_service_discovery_ref http_ref=NULL;
|
||||||
|
unsigned short usPort=port;
|
||||||
signal(SIGINT, rend_sigint); // SIGINT is what you get for a Ctrl-C
|
|
||||||
|
|
||||||
|
|
||||||
DPRINTF(ERR_DEBUG,"Registering services\n");
|
|
||||||
|
|
||||||
daap_ref=DNSServiceRegistrationCreate(name,"_daap._tcp",".local",port,"",rend_reply,nil);
|
|
||||||
http_ref=DNSServiceRegistrationCreate(name,"_http._tcp",".local",port,"",rend_reply,nil);
|
|
||||||
|
|
||||||
if(rend_addtorunloop(daap_ref) || rend_addtorunloop(http_ref)) {
|
|
||||||
DPRINTF(ERR_WARN,"Add to runloop failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*pid=fork();
|
*pid=fork();
|
||||||
if(*pid) {
|
if(*pid) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal(SIGINT, rend_sigint); // SIGINT is what you get for a Ctrl-C
|
||||||
|
|
||||||
|
|
||||||
|
DPRINTF(ERR_DEBUG,"Registering services\n");
|
||||||
|
|
||||||
|
daap_ref=DNSServiceRegistrationCreate(name,"_daap._tcp","",usPort,"",rend_reply,nil);
|
||||||
|
http_ref=DNSServiceRegistrationCreate(name,"_http._tcp","",port,"",rend_reply,nil);
|
||||||
|
|
||||||
|
if(rend_addtorunloop(daap_ref)|| rend_addtorunloop(http_ref)) {
|
||||||
|
DPRINTF(ERR_WARN,"Add to runloop failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rend_runloop = CFRunLoopGetCurrent();
|
||||||
|
|
||||||
|
|
||||||
DPRINTF(ERR_DEBUG,"Registered rendezvous services\n");
|
DPRINTF(ERR_DEBUG,"Registered rendezvous services\n");
|
||||||
|
|
||||||
CFRunLoopRun();
|
CFRunLoopRun();
|
||||||
|
|
||||||
|
DPRINTF(ERR_DEBUG,"Exiting runloop\n");
|
||||||
|
|
||||||
DNSServiceDiscoveryDeallocate(daap_ref);
|
DNSServiceDiscoveryDeallocate(daap_ref);
|
||||||
DNSServiceDiscoveryDeallocate(http_ref);
|
DNSServiceDiscoveryDeallocate(http_ref);
|
||||||
|
|
||||||
return 0;
|
exit(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user