Code

Added queue entry start / stop
[gosa.git] / gosa-core / include / class_socketClient.inc
old mode 100755 (executable)
new mode 100644 (file)
index 2e2033b..7223045
@@ -114,15 +114,19 @@ class Socket_Client
                if($this->handle){
 
                        /* Check if there is something to read for us */
-                       $read = array("0"=>$this->handle);      
-                       $num = @stream_select($read,$write=NULL,$accept=NULL,$this->timeout);
+                       $read = array("0"=>$this->handle);
+                       $write = array();
+                       $accept = array();      
+                       $start = microtime();           
+                       $num = @stream_select($read,$write,$accept,floor($this->timeout), ceil($this->timeout*100000));
                        $str = "";              
-               
+                       socket_set_timeout($this->handle,$this->timeout);                       
+
                        /* Read data if necessary */
-                       while($num && $this->b_data_send){
+                       while($num && get_MicroTimeDiff($start,microtime()) < $this->timeout){
                                $str.= fread($this->handle, 1024000);
                                $read = array("0"=>$this->handle);      
-                               $num = @stream_select($read,$write=NULL,$accept=NULL,$this->timeout);
+                               $num = stream_select($read,$write,$accept,0,200);
                        }
                        $this->bytes_read = strlen($str);
                        $this->b_data_send = FALSE;
@@ -147,8 +151,5 @@ class Socket_Client
                /* Terminate decryption handle and close module */
                mcrypt_generic_deinit($this->td);
        }
-
 }
-
-
 ?>