Skip to content

Commit 4d377da

Browse files
committed
Deprecate Executor $timeout parameter and switch to TimeoutConnector
1 parent 71d31f0 commit 4d377da

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Query/Executor.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ class Executor implements ExecutorInterface
1818
private $timeout;
1919

2020
/**
21+
*
22+
* Note that albeit supported, the $timeout parameter is deprecated!
23+
* You should pass a `null` value here instead. If you need timeout handling,
24+
* use the `TimeoutConnector` instead.
2125
*
2226
* @param LoopInterface $loop
2327
* @param Parser $parser
2428
* @param BinaryDumper $dumper
25-
* @param float|null $timeout timeout for DNS query or NULL=no timeout
29+
* @param null|float $timeout DEPRECATED: timeout for DNS query or NULL=no timeout
2630
*/
2731
public function __construct(LoopInterface $loop, Parser $parser, BinaryDumper $dumper, $timeout = 5)
2832
{

src/Resolver/Factory.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use React\Dns\Protocol\BinaryDumper;
1212
use React\EventLoop\LoopInterface;
1313
use React\Dns\Query\RetryExecutor;
14+
use React\Dns\Query\TimeoutExecutor;
1415

1516
class Factory
1617
{
@@ -36,7 +37,11 @@ public function createCached($nameserver, LoopInterface $loop, CacheInterface $c
3637

3738
protected function createExecutor(LoopInterface $loop)
3839
{
39-
return new Executor($loop, new Parser(), new BinaryDumper());
40+
return new TimeoutExecutor(
41+
new Executor($loop, new Parser(), new BinaryDumper(), null),
42+
5.0,
43+
$loop
44+
);
4045
}
4146

4247
protected function createRetryExecutor(LoopInterface $loop)

0 commit comments

Comments
 (0)