announce use new checkClient()

This commit is contained in:
xiaomlove
2022-02-25 19:12:14 +08:00
parent 9edbaf49ca
commit 57f1e92998
3 changed files with 21 additions and 4 deletions

View File

@@ -62,7 +62,8 @@ class Test extends Command
$peerId = '-TR2920-9bqp8iu7v9se';
$agent = 'Transmission/2.92';
$rep = new AgentAllowRepository();
$r = $rep->checkClient($peerId, $agent, true);
// $r = $rep->checkClient($peerId, $agent, true);
$r = array_slice([1,2], 1, 3);
dd($r);
}

View File

@@ -55,7 +55,8 @@ class AgentAllowRepository extends BaseRepository
throw new NexusException(sprintf('pattern: %s can not match start: %s', $pattern, $start));
}
$matchCount = count($matches) - 1;
if ($matchNum > $matchCount) {
//due to old data may be matchNum > matchCount
if ($matchNum > $matchCount && !IN_NEXUS) {
throw new NexusException("pattern: $pattern match start: $start got matches count: $matchCount, but require $matchNum.");
}
return array_slice($matches, 1, $matchNum);