mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-15 00:34:05 +09:00
join threads before closing sockets when stopping
fix for historical (minor) errors in RPiPlay from a mis-transcription of changes in upstream AirplayServer
This commit is contained in:
@@ -233,7 +233,9 @@ raop_rtp_mirror_thread(void *arg)
|
||||
/* Timeout happened */
|
||||
continue;
|
||||
} else if (ret == -1) {
|
||||
logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror error in select");
|
||||
int sock_err = SOCKET_GET_ERROR();
|
||||
logger_log(raop_rtp_mirror->logger, LOGGER_ERR,
|
||||
"raop_rtp_mirror error in select %d %s", sock_err, SOCKET_ERROR_STRING(sock_err));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -904,14 +906,14 @@ void raop_rtp_mirror_stop(raop_rtp_mirror_t *raop_rtp_mirror) {
|
||||
raop_rtp_mirror->running = 0;
|
||||
MUTEX_UNLOCK(raop_rtp_mirror->run_mutex);
|
||||
|
||||
/* Join the thread */
|
||||
THREAD_JOIN(raop_rtp_mirror->thread_mirror);
|
||||
|
||||
if (raop_rtp_mirror->mirror_data_sock != -1) {
|
||||
closesocket(raop_rtp_mirror->mirror_data_sock);
|
||||
raop_rtp_mirror->mirror_data_sock = -1;
|
||||
}
|
||||
|
||||
/* Join the thread */
|
||||
THREAD_JOIN(raop_rtp_mirror->thread_mirror);
|
||||
|
||||
/* Mark thread as joined */
|
||||
MUTEX_LOCK(raop_rtp_mirror->run_mutex);
|
||||
raop_rtp_mirror->joined = 1;
|
||||
|
||||
Reference in New Issue
Block a user