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

Author: Lars Michelsen <[email protected]>
Date:   Sun Nov  1 00:18:42 2009 +0100

Improved error handling while reading from livestatus socket

---

 .../core/classes/GlobalBackendmklivestatus.php     |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/share/server/core/classes/GlobalBackendmklivestatus.php 
b/share/server/core/classes/GlobalBackendmklivestatus.php
index 9cef439..171c269 100644
--- a/share/server/core/classes/GlobalBackendmklivestatus.php
+++ b/share/server/core/classes/GlobalBackendmklivestatus.php
@@ -127,10 +127,16 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                
                // Read all information from the response and add it to a string
                $read = '';
-               while('' != ($r = socket_read($sock, 65536))) {
+               while('' != ($r = @socket_read($sock, 65536))) {
                        $read .= $r;
                }
                
+               // Catch problems occured while reading? 104: Connection reset 
by peer
+               if(socket_last_error($sock) == 104) {
+                       new GlobalMessage('ERROR', 
GlobalCore::getInstance()->getLang()->getText('Problem while reading from 
socket [SOCKET] in backend [BACKENDID]: [MSG]', Array('BACKENDID' => 
$this->backendId, 'SOCKET' => $this->socketPath, 'MSG' => 
socket_strerror(socket_last_error($sock)))));
+                       return Array();
+               }
+               
                // Important: The socket needs to be closed after reading
                socket_close($sock);
                


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to