Skip to content

Commit 1e5b42d

Browse files
author
yggverse
committed
add timeout attribute
1 parent a57028f commit 1e5b42d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var_dump(
4040

4141
```
4242
var_dump(
43-
\Yggverse\Net\Dig::records('yo.index', ['A', 'AAAA'], &$result = [], &$error = [], $provider = null)
43+
\Yggverse\Net\Dig::records('yo.index', ['A', 'AAAA'], &$result = [], &$error = [], $provider = null, $timeout = 5)
4444
);
4545
```
4646

src/Dig.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function isRecordValue(mixed $record, mixed $value): bool
5353
);
5454
}
5555

56-
public static function records(string $hostname, array $records, array &$result = [], array &$error = [], ?string $provider = null): array
56+
public static function records(string $hostname, array $records, array &$result = [], array &$error = [], ?string $provider = null, int $timeout = 5): array
5757
{
5858
if (self::isProvider($provider))
5959
{
@@ -69,7 +69,7 @@ public static function records(string $hostname, array $records, array &$result
6969
{
7070
if (self::isRecord($record))
7171
{
72-
if ($values = exec(sprintf('dig %s %s %s +short', (string) $provider, (string) $record, (string) $hostname)))
72+
if ($values = exec(sprintf('dig %s %s %s +short +time=%d', (string) $provider, $record, $hostname, $timeout)))
7373
{
7474
foreach (explode(PHP_EOL, $values) as $value)
7575
{

0 commit comments

Comments
 (0)