mirror of
https://github.com/danog/amp.git
synced 2024-11-26 20:15:00 +01:00
Fix
This commit is contained in:
parent
c6bf4c5023
commit
ee6e57f2e5
@ -19,9 +19,9 @@ final class TimeoutCancellation implements Cancellation
|
|||||||
/**
|
/**
|
||||||
* @param float $timeout Seconds until cancellation is requested.
|
* @param float $timeout Seconds until cancellation is requested.
|
||||||
* @param string $message Message for TimeoutException. Default is "Operation timed out".
|
* @param string $message Message for TimeoutException. Default is "Operation timed out".
|
||||||
* @param bool $unreference Whether to unreference the timer.
|
* @param bool $reference Whether to reference the timer.
|
||||||
*/
|
*/
|
||||||
public function __construct(float $timeout, string $message = "Operation timed out", bool $unreference = true)
|
public function __construct(float $timeout, string $message = "Operation timed out", bool $reference = false)
|
||||||
{
|
{
|
||||||
$this->cancellation = $source = new Internal\Cancellable;
|
$this->cancellation = $source = new Internal\Cancellable;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ final class TimeoutCancellation implements Cancellation
|
|||||||
$source->cancel(new TimeoutException($message));
|
$source->cancel(new TimeoutException($message));
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($unreference) {
|
if (!$reference) {
|
||||||
EventLoop::unreference($this->watcher);
|
EventLoop::unreference($this->watcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user