mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
... not my finest work
This commit is contained in:
@@ -228,8 +228,6 @@ class NetworkSession{
|
||||
$this->onSessionStartSuccess(...)
|
||||
));
|
||||
|
||||
$this->addRepeatedPacketFilter(InventoryTransactionPacket::NETWORK_ID);
|
||||
|
||||
$this->manager->add($this);
|
||||
$this->logger->info($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_network_session_open()));
|
||||
}
|
||||
@@ -359,27 +357,6 @@ class NetworkSession{
|
||||
}
|
||||
}
|
||||
|
||||
public function addRepeatedPacketFilter(int $packetId) : void{
|
||||
$this->repeatedPacketFilters[$packetId] = "";
|
||||
$this->repeatedPacketFilterStats[$packetId] = 0;
|
||||
}
|
||||
|
||||
public function removeRepeatedPacketFilter(int $packetId) : void{
|
||||
unset($this->repeatedPacketFilters[$packetId]);
|
||||
unset($this->repeatedPacketFilterStats[$packetId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stats for repeated packet filters, indexed by packet ID.
|
||||
* The value is the number of times a packet was dropped due to being repeated.
|
||||
*
|
||||
* @return int[]
|
||||
* @phpstan-return array<int, int>
|
||||
*/
|
||||
public function getRepeatedPacketFilterStats() : array{
|
||||
return $this->repeatedPacketFilterStats;
|
||||
}
|
||||
|
||||
private function checkRepeatedPacketFilter(string $buffer) : bool{
|
||||
if($buffer === $this->noisyPacketBuffer){
|
||||
$this->noisyPacketsDropped++;
|
||||
|
Reference in New Issue
Block a user