Code

Added queue entry start / stop
[gosa.git] / gosa-core / include / class_socketClient.inc
index 0ed42a5fa3fda35febbf76d423f71a1e342b5f34..72230451b4fda08f689fe71c557afe26680fde03 100644 (file)
@@ -117,14 +117,16 @@ class Socket_Client
                        $read = array("0"=>$this->handle);
                        $write = array();
                        $accept = array();      
-                       $num = @stream_select($read,$write,$accept,floor($this->timeout), ceil($this->timeout*1000000));
+                       $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,$accept,floor($this->timeout), ceil($this->timeout*1000000));
+                               $num = stream_select($read,$write,$accept,0,200);
                        }
                        $this->bytes_read = strlen($str);
                        $this->b_data_send = FALSE;