From a4300bee582af333e1d677d6bd280a39dce70c44 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 2 Jun 2014 08:13:12 +0200 Subject: [PATCH] tcp: break the timeout loop early when tvheadend is in the shutdown phase --- src/tcp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tcp.c b/src/tcp.c index f2c5e6e4..a9f7e1bf 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -118,6 +118,12 @@ tcp_connect(const char *hostname, int port, const char *bindaddr, timeout = 0; while (1) { + if (!tvheadend_running) { + tvhpoll_destroy(efd); + close(fd); + return -1; + } + r = tvhpoll_wait(efd, &ev, 1, timeout * 1000); if (r > 0) break;