Skip to content

Commit

Permalink
Improved defer tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
andot committed Aug 10, 2016
1 parent 7daf980 commit 3b524e5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Hprose/Socket/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* *
* hprose socket Service library for php 5.3+ *
* *
* LastModified: Aug 8, 2016 *
* LastModified: Aug 10, 2016 *
* Author: Ma Bingyao <[email protected]> *
* *
\**********************************************************/
Expand Down Expand Up @@ -294,11 +294,14 @@ public function error($server, $socket, $ex) {
$this->close($socket, $context);
}
private function timeout() {
$deadlines = $this->deadlines;
if (empty($deadlines)) {
return 3600;
if (empty($this->deferTasks)) {
$deadlines = $this->deadlines;
if (empty($deadlines)) {
return 3600;
}
return max(0, min($deadlines) - microtime(true));
}
return max(0, min($deadlines) - microtime(true));
return 0;
}
public function handle($servers) {
$readableSockets = &$this->readableSockets;
Expand Down

0 comments on commit 3b524e5

Please sign in to comment.