]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Block on command_execute for unfixable errors.
authorMike Brady <mikebrady@eircom.net>
Tue, 15 Jan 2019 08:30:00 +0000 (08:30 +0000)
committerMike Brady <mikebrady@eircom.net>
Tue, 15 Jan 2019 08:30:00 +0000 (08:30 +0000)
common.c
common.h
player.c
rtsp.c

index 05edae98f45447575cfeb4cdf344d46acba1413e..729bcacdfcdc12a9ee40d09d802052d75843d681 100644 (file)
--- a/common.c
+++ b/common.c
@@ -739,7 +739,7 @@ void command_start(void) {
     }
   }
 }
-void command_execute(const char *command, const char *extra_argument) {
+void command_execute(const char *command, const char *extra_argument, const int block) {
   // this has a cancellation point if waiting is enabled
   if (command) {
     char new_command_buffer[1024];
@@ -767,7 +767,7 @@ void command_execute(const char *command, const char *extra_argument) {
         exit(127); /* only if execv fails */
       }
     } else {
-      if (config.cmd_blocking) { /* pid!=0 means parent process and if blocking is true, wait for
+      if (block) { /* pid!=0 means parent process and if blocking is true, wait for
                                     process to finish */
         pid_t rc = waitpid(pid, 0, 0); /* wait for child to exit */
         if (rc != pid) {
index 6f07f6d30f4e50f718dcf80140029b1653565fa7..c6d5ae3a2b8b474c79ef5a263c2a3db504198ca9 100644 (file)
--- a/common.h
+++ b/common.h
@@ -309,7 +309,7 @@ int config_set_lookup_bool(config_t *cfg, char *where, int *dst);
 
 void command_start(void);
 void command_stop(void);
-void command_execute(const char *command, const char *extra_argument);
+void command_execute(const char *command, const char *extra_argument, const int block);
 void command_set_volume(double volume);
 
 int mkpath(const char *path, mode_t mode);
index 36461c45dae93b1dd7c7cd37f091b90c55635ef5..ba40bf5be9e5743230dc751c70014e37c3a32ffe 100644 (file)
--- a/player.c
+++ b/player.c
@@ -1098,7 +1098,7 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
                         (conn->unfixable_error_reported == 0)) {
                       conn->unfixable_error_reported = 1;
                       if (config.cmd_unfixable) {
-                        command_execute(config.cmd_unfixable, "output_device_stalled");
+                        command_execute(config.cmd_unfixable, "output_device_stalled", 1);
                       } else {
                         warn(
                             "an unrecoverable error, \"output_device_stalled\", has been detected.",
@@ -2010,7 +2010,7 @@ void *player_thread_func(void *arg) {
                        "stalled. Executing the "
                        "\"run_this_if_an_unfixable_error_is_detected\" command.",
                        conn->connection_number);
-                  command_execute(config.cmd_unfixable, "output_device_stalled");
+                  command_execute(config.cmd_unfixable, "output_device_stalled", 1);
                 } else {
                   warn("Connection %d: An unfixable error has been detected -- output device is "
                        "stalled. \"No "
diff --git a/rtsp.c b/rtsp.c
index 6e98944f616b6ceaddb21b028cbd28471074aad5..4a0be9ba2df07523cea24d2e2f4da0b511b67f50 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -296,7 +296,7 @@ void *player_watchdog_thread_code(void *arg) {
           } else if (conn->watchdog_barks == 3) {
             if ((config.cmd_unfixable) && (conn->unfixable_error_reported == 0)) {
               conn->unfixable_error_reported = 1;
-              command_execute(config.cmd_unfixable, "unable_to_cancel_play_session");
+              command_execute(config.cmd_unfixable, "unable_to_cancel_play_session",1);
             } else {
               warn("an unrecoverable error, \"unable_to_cancel_play_session\", has been detected.",
                    conn->connection_number);