From 45b61d1ad668d318275f91d40c6e74111707fb95 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 21 Jan 2008 10:47:33 +0000 Subject: [PATCH] Fixed socket timeout git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8515 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_socketClient.inc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gosa-core/include/class_socketClient.inc b/gosa-core/include/class_socketClient.inc index 0ed42a5fa..7f571a31e 100644 --- a/gosa-core/include/class_socketClient.inc +++ b/gosa-core/include/class_socketClient.inc @@ -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){ - $str.= fread($this->handle, 1024000); + while($num && get_MicroTimeDiff($start,microtime()) < $this->timeout){ + $str.= fread($this->handle, 100); $read = array("0"=>$this->handle); - $num = @stream_select($read,$write,$accept,floor($this->timeout), ceil($this->timeout*1000000)); + $num = @stream_select($read,$write,$accept,floor($this->timeout), ceil($this->timeout*100000)); } $this->bytes_read = strlen($str); $this->b_data_send = FALSE; -- 2.30.2