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;