From 1037ccfeb17c7f8f9b8b727f61a8adb45f7b8b19 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Fri, 23 May 2008 11:45:53 +1200 Subject: [PATCH] Add a timeout when fetching the XML status page from the backend. --- ChangeLog | 3 +++ bin/mythtv-status | 10 +++++++++- debian/changelog | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d72bfd2..cc0e745 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2008-05-23 Andrew Ruthven + Add a timeout for the HTTP request to the backend. + 2008-04-19 Andrew Ruthven Add a molly-guard check diff --git a/bin/mythtv-status b/bin/mythtv-status index 35587ef..1ef59df 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -531,7 +531,15 @@ sub load_xml { close IN; } else { my $url = "http://$host:$port/xml"; - $status = get($url); + eval { + local $SIG{ALRM} = sub { die "alarm\n" }; + alarm(15); + $status = get($url); + alarm(0); + }; + + die "Sorry, failed to fetch $url: Connection to MythTV timed out.\n" + if $@; die "Sorry, failed to fetch $url.\n" unless defined $status; diff --git a/debian/changelog b/debian/changelog index 76f3e67..748e9e6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +mythtv-status (0.7.4-1) unstable; urgency=low + + * New upstream release. + + -- Andrew Ruthven Fri, 23 May 2008 09:31:39 +1200 + mythtv-status (0.7.3-2) unstable; urgency=low * The cron.daily file should honour the HOST setting in -- 2.30.2