Module: nagvis
Branch: master
Commit: 05b25241499325609ce3fd503609b353d7bc907b
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=05b25241499325609ce3fd503609b353d7bc907b

Author: Lars Michelsen <[email protected]>
Date:   Thu Jun 17 18:34:51 2010 +0200

#315 Connection problems are reported as "ERROR" state for the objects now

---

 .../core/classes/GlobalBackendmklivestatus.php     |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/share/server/core/classes/GlobalBackendmklivestatus.php 
b/share/server/core/classes/GlobalBackendmklivestatus.php
index 3ac388e..ff7ff11 100644
--- a/share/server/core/classes/GlobalBackendmklivestatus.php
+++ b/share/server/core/classes/GlobalBackendmklivestatus.php
@@ -168,14 +168,23 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                }
                
                // Connect to the socket
+               // don't want to see the connection error messages - want to 
handle the
+               // errors later with an own error message
                if($this->socketType === 'unix') {
+                       $oldLevel = error_reporting(0);
                        $result = socket_connect($this->SOCKET, 
$this->socketPath);
+                       error_reporting($oldLevel);
                } elseif($this->socketType === 'tcp') {
+                       $oldLevel = error_reporting(0);
                        $result = socket_connect($this->SOCKET, 
$this->socketAddress, $this->socketPort);
+                       error_reporting($oldLevel);
                }
-               
+
                if($result == false) {
-                       throw new 
BackendConnectionProblem(GlobalCore::getInstance()->getLang()->getText('Unable 
to connect to the [SOCKET] in backend [BACKENDID]: [MSG]', Array('BACKENDID' => 
$this->backendId, 'SOCKET' => $this->socketPath, 'MSG' => 
socket_strerror(socket_last_error($this->SOCKET)))));
+                       $socketError = 
socket_strerror(socket_last_error($this->SOCKET));
+                       $this->SOCKET = null;
+                       throw new 
BackendConnectionProblem(GlobalCore::getInstance()->getLang()->getText('Unable 
to connect to the [SOCKET] in backend [BACKENDID]: [MSG]',
+                                                                               
 Array('BACKENDID' => $this->backendId, 'SOCKET' => $this->socketPath, 'MSG' => 
$socketError)));
                }
 
                // Maybe set some socket options


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to