static void
satip_frontend_request_cleanup
- ( satip_frontend_t *lfe, satip_tune_req_t *tr )
+ ( satip_frontend_t *lfe, satip_tune_req_t **_tr )
{
+ satip_tune_req_t *tr = *_tr;
if (tr && tr != lfe->sf_req) {
mpegts_pid_done(&tr->sf_pids);
mpegts_pid_done(&tr->sf_pids_tuned);
free(tr);
+ *_tr = NULL;
}
if (tr == lfe->sf_req_thread)
lfe->sf_req_thread = NULL;
static void
satip_frontend_shutdown
( satip_frontend_t *lfe, const char *name, http_client_t *rtsp,
- satip_tune_req_t *tr, tvhpoll_t *efd )
+ satip_tune_req_t **tr, tvhpoll_t *efd )
{
char b[32];
tvhpoll_event_t ev;
sbuf_free(&lfe->sf_sbuf);
pthread_mutex_lock(&lfe->sf_dvr_lock);
+ satip_frontend_wake_other_waiting(lfe, *tr);
satip_frontend_request_cleanup(lfe, tr);
pthread_mutex_unlock(&lfe->sf_dvr_lock);
}
ev.data.ptr = NULL;
tvhpoll_rem(efd, &ev, 1);
- satip_frontend_shutdown(lfe, name, *rtsp, *tr, efd);
+ satip_frontend_shutdown(lfe, name, *rtsp, tr, efd);
memset(&ev, 0, sizeof(ev));
ev.events = TVHPOLL_IN;
tvhpoll_add(efd, &ev, 1);
http_client_close(*rtsp);
- satip_frontend_wake_other_waiting(lfe, *tr);
*rtsp = NULL;
- *tr = NULL;
}
static int
lfe->mi_display_name((mpegts_input_t*)lfe, buf, sizeof(buf));
pthread_mutex_lock(&lfe->sf_dvr_lock);
- satip_frontend_request_cleanup(lfe, tr);
+ satip_frontend_request_cleanup(lfe, &tr);
lfe->sf_req_thread = tr = lfe->sf_req;
pthread_mutex_unlock(&lfe->sf_dvr_lock);
tvhpoll_rem(efd, ev, nfds);
if (exit_flag) {
- satip_frontend_shutdown(lfe, buf, rtsp, tr, efd);
+ satip_frontend_shutdown(lfe, buf, rtsp, &tr, efd);
http_client_close(rtsp);
rtsp = NULL;
- tr = NULL;
}
done:
goto new_tune;
pthread_mutex_lock(&lfe->sf_dvr_lock);
- satip_frontend_request_cleanup(lfe, tr);
+ satip_frontend_request_cleanup(lfe, &tr);
pthread_mutex_unlock(&lfe->sf_dvr_lock);
if (rtsp)