From e5aa7387f72964f0c1defd68d36413146658339b Mon Sep 17 00:00:00 2001 From: mattwire <> Date: Tue, 23 Jun 2015 20:36:03 +0000 Subject: [PATCH] - bugfix: 30_MilightBridge: Minor change to ping code to try and resolve crash when hostname not in dns git-svn-id: https://svn.fhem.de/fhem/trunk@8812 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/30_MilightBridge.pm | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 78e501a17..75008ef2b 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 30_MilightBridge: Minor change to ping code to try and resolve + crash when hostname not in dns - bugfix: pilight_ctrl: reset - clear send queue - feature: pilight_ctrl: add attribute SendTimeout for aborting sending commands - feature: FB_CALLMONITOR: add TR-064 support for remote phonebook reading diff --git a/fhem/FHEM/30_MilightBridge.pm b/fhem/FHEM/30_MilightBridge.pm index ec71b815c..611341f50 100644 --- a/fhem/FHEM/30_MilightBridge.pm +++ b/fhem/FHEM/30_MilightBridge.pm @@ -203,14 +203,12 @@ sub MilightBridge_State(@) # Do a ping check to see if bridge is reachable # check via ping - my $pingstatus = "ok"; + my $pingstatus = "unreachable"; my $p = Net::Ping->new('udp'); - if( $p->ping($hash->{HOST}, 2)) { - $pingstatus = "ok"; - } else { - $pingstatus = "unreachable"; - } + my $alive = $p->ping($hash->{HOST}, 2); $p->close(); + $pingstatus = "ok" if $alive; + # And update state readingsSingleUpdate($hash, "state", $pingstatus, 1);