From 69c78510ffafc406a833e346bd4527da49ff8224 Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 6 Oct 2023 21:42:46 +0000 Subject: [PATCH] Attempt at fixing issues with acting as a public tracker. --- src/Torrents/TorrentPeerInfo.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Torrents/TorrentPeerInfo.php b/src/Torrents/TorrentPeerInfo.php index 00d754b..b99c81f 100644 --- a/src/Torrents/TorrentPeerInfo.php +++ b/src/Torrents/TorrentPeerInfo.php @@ -49,9 +49,10 @@ readonly class TorrentPeerInfo { return $this->userId !== null; } - public function verifyUser(UserInfo $userInfo): bool { - return !$this->hasUserId() - || ($userInfo !== null && $userInfo->getId() === $this->userId); + public function verifyUser(?UserInfo $userInfo): bool { + return $this->userId === null + ? $userInfo === null + : $this->userId === $userInfo->getId(); } public function getAddress(): string {