From: Mike Brady Date: Sun, 3 Jun 2018 18:59:24 +0000 (+0100) Subject: Use shutdown() before close() and separate out the cancel requests for the timing... X-Git-Tag: 3.2RC11~3^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6eab2d1617e1b7ce756d284bbeeadb3e4a346f4b;p=thirdparty%2Fshairport-sync.git Use shutdown() before close() and separate out the cancel requests for the timing, control and audio threads, see if we can see anything. --- diff --git a/player.c b/player.c index ed844f6a..e05cebc1 100644 --- a/player.c +++ b/player.c @@ -2335,14 +2335,19 @@ static void *player_thread_func(void *arg) { config.output->stop(); debug(2, "Cancelling timing, control and audio threads..."); + debug(2, "Cancel timing thread."); pthread_cancel(rtp_timing_thread); - pthread_cancel(rtp_control_thread); - pthread_cancel(rtp_audio_thread); - debug(2, "Joining terminated threads."); + debug(2, "Join timing thread."); pthread_join(rtp_timing_thread, NULL); debug(2, "Timing thread terminated."); + debug(2, "Cancel control thread."); + pthread_cancel(rtp_control_thread); + debug(2, "Join control thread."); pthread_join(rtp_control_thread, NULL); debug(2, "Control thread terminated."); + debug(2, "Cancel audio thread."); + pthread_cancel(rtp_audio_thread); + debug(2, "Join audio thread."); pthread_join(rtp_audio_thread, NULL); debug(2, "Audio thread terminated."); clear_reference_timestamp(conn); diff --git a/rtp.c b/rtp.c index bb28be87..6a588b0b 100644 --- a/rtp.c +++ b/rtp.c @@ -68,6 +68,9 @@ void rtp_terminate(rtsp_conn_info *conn) { void rtp_audio_receiver_cleanup_handler(void *arg) { debug(3, "Audio Receiver Cleanup."); rtsp_conn_info *conn = (rtsp_conn_info *)arg; + debug(1,"shutdown audio socket."); + shutdown(conn->audio_socket,SHUT_RDWR); + debug(1,"close audio socket."); close(conn->audio_socket); debug(3, "Audio Receiver Cleanup Successful."); } @@ -188,6 +191,9 @@ void *rtp_audio_receiver(void *arg) { void rtp_control_handler_cleanup_handler(void *arg) { debug(3, "Control Receiver Cleanup."); rtsp_conn_info *conn = (rtsp_conn_info *)arg; + debug(1,"shutdown control socket."); + shutdown(conn->control_socket,SHUT_RDWR); + debug(1,"close control socket."); close(conn->control_socket); debug(3, "Control Receiver Cleanup Successful."); } @@ -471,6 +477,9 @@ void rtp_timing_receiver_cleanup_handler(void *arg) { rtsp_conn_info *conn = (rtsp_conn_info *)arg; pthread_cancel(conn->timer_requester); pthread_join(conn->timer_requester, NULL); + debug(1,"shutdown timing socket."); + shutdown(conn->timing_socket,SHUT_RDWR); + debug(1,"close timing socket."); close(conn->timing_socket); debug(3, "Timing Receiver Cleanup Successful."); }