From: Kin-Wai Koo Date: Tue, 22 Jan 2019 00:52:39 +0000 (+0800) Subject: Avoid caching HDHomeRun's IP address X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a68b343df404f209886035aee479b80a6336cf9c;p=thirdparty%2Ftvheadend.git Avoid caching HDHomeRun's IP address --- diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c index cf1184214..4f17d0ef8 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c @@ -387,18 +387,14 @@ static void tvhdhomerun_device_create(struct hdhomerun_discover_device_t *dInfo) static uint32_t tvhdhomerun_ip( void ) { - static int homerun_ip_initialized = 0; - static uint32_t ip = 0; + if (*config.hdhomerun_ip == 0) return 0; + + uint32_t ip = 0; + if (inet_pton(AF_INET, config.hdhomerun_ip, &ip)) + ip = ntohl(ip); + else + tvhwarn(LS_TVHDHOMERUN, "Could not parse IP address %s", config.hdhomerun_ip); - if (!homerun_ip_initialized) - { - if ((*config.hdhomerun_ip != 0) && inet_pton(AF_INET, config.hdhomerun_ip, &ip)) - { - tvhinfo(LS_TVHDHOMERUN, "HDHomerun IP set to %s", config.hdhomerun_ip); - ip = ntohl(ip); - } - homerun_ip_initialized = 1; - } return ip; }