mirror of
https://github.com/danog/dns.git
synced 2024-11-30 04:29:06 +01:00
Fix #68 - cyclic reference within BasicResolver->gcWatcher
This commit is contained in:
parent
36ef1a6959
commit
cbaa517c8a
@ -55,17 +55,18 @@ final class BasicResolver implements Resolver {
|
|||||||
|
|
||||||
$this->questionFactory = new QuestionFactory;
|
$this->questionFactory = new QuestionFactory;
|
||||||
|
|
||||||
$this->gcWatcher = Loop::repeat(5000, function () {
|
$sockets = &$this->sockets;
|
||||||
if (empty($this->sockets)) {
|
$this->gcWatcher = Loop::repeat(5000, static function () use (&$sockets) {
|
||||||
|
if (!$sockets) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$now = \time();
|
$now = \time();
|
||||||
|
|
||||||
foreach ($this->sockets as $key => $server) {
|
foreach ($sockets as $key => $server) {
|
||||||
if ($server->getLastActivity() < $now - 60) {
|
if ($server->getLastActivity() < $now - 60) {
|
||||||
$server->close();
|
$server->close();
|
||||||
unset($this->sockets[$key]);
|
unset($sockets[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user