Double check debug is not a cancellation point and move the dacp monitor initialisation code to after the subsidiary session threads are created.
This commit is contained in:
@@ -173,6 +173,10 @@ void debug(int level, const char *format, ...) {
|
||||
va_start(args, format);
|
||||
vsnprintf(s, sizeof(s), format, args);
|
||||
va_end(args);
|
||||
int currentState;
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, ¤tState);
|
||||
if (currentState == PTHREAD_CANCEL_ENABLE)
|
||||
daemon_log(LOG_DEBUG, "Warning -- cancellation is enabled before logging");
|
||||
if ((config.debugger_show_elapsed_time) && (config.debugger_show_relative_time))
|
||||
daemon_log(LOG_DEBUG, "|% 20.9f|% 20.9f|%s", tss, tsl, s);
|
||||
else if (config.debugger_show_relative_time)
|
||||
@@ -181,6 +185,9 @@ void debug(int level, const char *format, ...) {
|
||||
daemon_log(LOG_DEBUG, "% 20.9f|%s", tss, s);
|
||||
else
|
||||
daemon_log(LOG_DEBUG, "%s", s);
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, ¤tState);
|
||||
if (currentState == PTHREAD_CANCEL_ENABLE)
|
||||
daemon_log(LOG_DEBUG, "Warning -- cancellation is enabled after logging");
|
||||
pthread_setcancelstate(oldState,NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1677,23 +1677,6 @@ void *player_thread_func(void *arg) {
|
||||
int sync_error_out_of_bounds =
|
||||
0; // number of times in a row that there's been a serious sync error
|
||||
|
||||
// stop looking elsewhere for DACP stuff
|
||||
#ifdef CONFIG_DACP_CLIENT
|
||||
// debug(1, "Set dacp server info");
|
||||
// this does not have pthread cancellation points in it (assuming avahi doesn't)
|
||||
set_dacp_server_information(conn); // this will start scanning when a port is registered by the
|
||||
// code initiated by the mdns_dacp_monitor
|
||||
#else
|
||||
// this is only used for compatability, if dacp stuff isn't enabled.
|
||||
// start an mdns/zeroconf thread to look for DACP messages containing our DACP_ID and getting the
|
||||
// port number
|
||||
if (conn->dapo_private_storage)
|
||||
debug(1, "DACP monitor already initialised?");
|
||||
else
|
||||
// this does not have pthread cancellation points in it (assuming avahi doesn't)
|
||||
conn->dapo_private_storage = mdns_dacp_monitor(conn->dacp_id);
|
||||
#endif
|
||||
|
||||
conn->framesProcessedInThisEpoch = 0;
|
||||
conn->framesGeneratedInThisEpoch = 0;
|
||||
conn->correctionsRequestedInThisEpoch = 0;
|
||||
@@ -1758,6 +1741,23 @@ void *player_thread_func(void *arg) {
|
||||
|
||||
pthread_cleanup_push(player_thread_cleanup_handler, arg); // undo what's been done so far
|
||||
|
||||
// stop looking elsewhere for DACP stuff
|
||||
#ifdef CONFIG_DACP_CLIENT
|
||||
// debug(1, "Set dacp server info");
|
||||
// this does not have pthread cancellation points in it (assuming avahi doesn't)
|
||||
set_dacp_server_information(conn); // this will start scanning when a port is registered by the
|
||||
// code initiated by the mdns_dacp_monitor
|
||||
#else
|
||||
// this is only used for compatability, if dacp stuff isn't enabled.
|
||||
// start an mdns/zeroconf thread to look for DACP messages containing our DACP_ID and getting the
|
||||
// port number
|
||||
if (conn->dapo_private_storage)
|
||||
debug(1, "DACP monitor already initialised?");
|
||||
else
|
||||
// this does not have pthread cancellation points in it (assuming avahi doesn't)
|
||||
conn->dapo_private_storage = mdns_dacp_monitor(conn->dacp_id);
|
||||
#endif
|
||||
|
||||
// set the default volume to whaterver it was before, as stored in the config airplay_volume
|
||||
debug(2, "Set initial volume to %f.", config.airplay_volume);
|
||||
player_volume(config.airplay_volume, conn); // will contain a cancellation point if asked to wait
|
||||
|
||||
Reference in New Issue
Block a user