From a107a459d17d7917823b63e215d75f224ae3184c Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 27 Jun 2016 21:05:37 +0100 Subject: [PATCH] prevent run_this_before_play_begins or run_this_after_play_ends holding the RTSP port open --- configure.ac | 2 +- rtsp.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5ce74af8..32e50ed4 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.50]) -AC_INIT([shairport-sync], [2.8.4.2], [mikebrady@eircom.net]) +AC_INIT([shairport-sync], [2.8.4.3], [mikebrady@eircom.net]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([shairport.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/rtsp.c b/rtsp.c index cf94c52d..6e08cf32 100644 --- a/rtsp.c +++ b/rtsp.c @@ -1838,6 +1838,12 @@ void rtsp_listen_loop(void) { // strerror(errno)); continue; } + // Set the RTSP socket to close on exec() of child processes + // otherwise background run_this_before_play_begins or run_this_after_play_ends commands + // that are sleeping prevent the daemon from being restarted because + // the listening RTSP port is still in use. + // See: https://github.com/mikebrady/shairport-sync/issues/329 + fcntl(fd, F_SETFD, FD_CLOEXEC); ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)); #ifdef IPV6_V6ONLY