1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00
This commit is contained in:
Daniil Gentili 2023-08-07 18:56:14 +02:00
parent c6bf4c5023
commit ee6e57f2e5
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -19,9 +19,9 @@ final class TimeoutCancellation implements Cancellation
/**
* @param float $timeout Seconds until cancellation is requested.
* @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;
@ -38,7 +38,7 @@ final class TimeoutCancellation implements Cancellation
$source->cancel(new TimeoutException($message));
});
if ($unreference) {
if (!$reference) {
EventLoop::unreference($this->watcher);
}
}