summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 61f6407)
raw | patch | inline | side by side (parent: 61f6407)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 23 Jan 2008 08:50:19 +0000 (08:50 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 23 Jan 2008 08:50:19 +0000 (08:50 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8546 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_socketClient.inc | patch | blob | history |
index eefff1b7bd11b6df0e415b69af76d9a85be27b3c..75f97582845341c587ef9725a912a3e185a0e113 100644 (file)
return $this->b_data_send;
}
+
+ private _is_timeout($start,$stop = microtime())
+ {
+ $a = split("\ ",$start);
+ $b = split("\ ",$stop);
+ $secs = $b[1] - $a[1];
+ $msecs= $b[0] - $a[0];
+ $ret = (float) ($secs+ $msecs);
+ return($ret => $this->timeout);
+ }
+
public function read()
{
stream_set_blocking($this->handle,0);
$start = microtime();
- while(strlen($str) == 0 || get_MicroTimeDiff($start,microtime()) < $this->timeout) {
+ while(strlen($str) == 0 || !$this->_is_timeout($start)) {
usleep(10000);
$data = fread($this->handle, 1024000);
if($data && strlen($data)>0) {
break;
}
}
- if(get_MicroTimeDiff($start,microtime()) >= $this->timeout){
- trigger_error(sprintf("Exceeded timeout %f while reading from socket. Time spend for reading was %f.",$this->timeout,get_MicroTimeDiff($start,microtime())));
+ if($this->_is_timeout($start)){
+ trigger_error(sprintf("Exceeded timeout %f while reading from socket",$this->timeout));
}
$this->bytes_read = strlen($str);
$this->b_data_send = FALSE;