Skip to content

Commit a28d052

Browse files
committed
Allow disabling blocking of IPs on packet errors
closes #239
1 parent 0091fca commit a28d052

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/server/Server.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ public function __construct(
100100
private int $recvMaxSplitParts = ServerSession::DEFAULT_MAX_SPLIT_PART_COUNT,
101101
private int $recvMaxConcurrentSplits = ServerSession::DEFAULT_MAX_CONCURRENT_SPLIT_COUNT,
102102
private int $blockMessageSuppressionThreshold = self::BLOCK_MESSAGE_SUPPRESSION_THRESHOLD,
103-
private int $packetErrorSuppressionThreshold = self::PACKET_ERROR_SUPPRESSION_THRESHOLD
103+
private int $packetErrorSuppressionThreshold = self::PACKET_ERROR_SUPPRESSION_THRESHOLD,
104+
private bool $blockIpOnPacketErrors = true
104105
){
105106
if($maxMtuSize < Session::MIN_MTU_SIZE){
106107
throw new \InvalidArgumentException("MTU size must be at least " . Session::MIN_MTU_SIZE . ", got $maxMtuSize");
@@ -319,7 +320,9 @@ private function receivePacket() : bool{
319320
}
320321
}
321322
$this->packetErrorsSinceLastUpdate++;
322-
$this->blockAddress($address->getIp(), 5);
323+
if($this->blockIpOnPacketErrors){
324+
$this->blockAddress($address->getIp(), 5);
325+
}
323326
}
324327

325328
return true;

0 commit comments

Comments
 (0)