diff --git a/src/tcp.c b/src/tcp.c index 27ed5602..cab3c5ff 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -370,6 +370,7 @@ static void * tcp_server_start(void *aux) { tcp_server_launch_t *tsl = aux; + struct timeval to; int val; val = 1; @@ -393,6 +394,9 @@ tcp_server_start(void *aux) val = 1; setsockopt(tsl->fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); + to.tv_sec = 30; + to.tv_usec = 0; + setsockopt(tsl->fd, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof(to)); tsl->start(tsl->fd, tsl->opaque, &tsl->peer, &tsl->self); free(tsl); diff --git a/src/webui/webui.c b/src/webui/webui.c index a5daee7f..4e87b0b1 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -161,6 +161,11 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, else name = "Live Stream"; + /* reduce timeout on write() for streaming */ + tp.tv_sec = 5; + tp.tv_usec = 0; + setsockopt(hc->hc_fd, SOL_SOCKET, SO_SNDTIMEO, &tp, sizeof(tp)); + while(run) { pthread_mutex_lock(&sq->sq_mutex); sm = TAILQ_FIRST(&sq->sq_queue);