http server: improve shutdown for streaming

This commit is contained in:
Jaroslav Kysela 2014-10-26 21:01:20 +01:00
parent 46ce1de009
commit dec23cab69
3 changed files with 5 additions and 4 deletions

View file

@ -1016,8 +1016,10 @@ http_cancel( void *opaque )
{
http_connection_t *hc = opaque;
if (hc)
if (hc) {
shutdown(hc->hc_fd, SHUT_RDWR);
hc->hc_shutdown = 1;
}
}
/**

View file

@ -137,14 +137,13 @@ typedef struct http_connection {
int hc_no_output;
int hc_logout_cookie;
int hc_shutdown;
/* Support for HTTP POST */
char *hc_post_data;
unsigned int hc_post_len;
struct rtsp *hc_rtsp_session;
} http_connection_t;

View file

@ -253,7 +253,7 @@ http_stream_run(http_connection_t *hc, profile_chain_t *prch,
tp.tv_usec = 0;
setsockopt(hc->hc_fd, SOL_SOCKET, SO_SNDTIMEO, &tp, sizeof(tp));
while(run && tvheadend_running) {
while(!hc->hc_shutdown && run && tvheadend_running) {
pthread_mutex_lock(&sq->sq_mutex);
sm = TAILQ_FIRST(&sq->sq_queue);
if(sm == NULL) {