mirror of
https://github.com/danog/dns.git
synced 2024-11-26 20:14:51 +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->gcWatcher = Loop::repeat(5000, function () {
|
||||
if (empty($this->sockets)) {
|
||||
$sockets = &$this->sockets;
|
||||
$this->gcWatcher = Loop::repeat(5000, static function () use (&$sockets) {
|
||||
if (!$sockets) {
|
||||
return;
|
||||
}
|
||||
|
||||
$now = \time();
|
||||
|
||||
foreach ($this->sockets as $key => $server) {
|
||||
foreach ($sockets as $key => $server) {
|
||||
if ($server->getLastActivity() < $now - 60) {
|
||||
$server->close();
|
||||
unset($this->sockets[$key]);
|
||||
unset($sockets[$key]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user