Code

Updated for ping
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Feb 2008 15:55:02 +0000 (15:55 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Feb 2008 15:55:02 +0000 (15:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8964 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_gosaSupportDaemon.inc
gosa-core/include/class_socketClient.inc

index b712d7614f4cd04d8dd19ae71f7462c471231802..4427592eb54d17e10ad246cbb6da27c54d07b7b0 100644 (file)
@@ -590,6 +590,19 @@ class gosaSupportDaemon
   }
 
 
+  static function ping($target)
+  {
+    if (tests::is_mac($target)){
+    /* Get communication object */
+       $d= new gosaSupportDaemon(TRUE,0.5);
+
+       $answer= $d->_send("<xml><header>gosa_ping</header><source>GOSA</source><target>$target</target></xml>", TRUE);
+       return (count($answer) ? TRUE:FALSE);
+    }
+
+    return (FALSE);
+  }
+
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 2812e26880eab4dd50b5455bc3d2eb204d4b7348..7219459bcedc32b237c4963a9bc7cd39af98aa30 100644 (file)
@@ -62,7 +62,7 @@ class Socket_Client
   private function decrypt($data)
   {
     /* decrypt data */
-    if($this->b_encrypt){
+    if($this->b_encrypt && strlen($data)){
       $data = base64_decode($data);
       mcrypt_generic_init($this->td, $this->ckey, $this->iv);
       $data = mdecrypt_generic($this->td, $data);
@@ -140,7 +140,6 @@ class Socket_Client
         }
       }
       if((microtime(TRUE) - $start) > $this->timeout ){      
-        trigger_error(sprintf("Exceeded timeout %f while reading from socket",$this->timeout));
         break;
       }
     }