mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-23 11:54:04 +00:00
Don't bother with global batch compression if there is only 1 recipient
this allows the session to achieve better ratios, and also reduces worker pool spam.
This commit is contained in:
parent
eb2f0ed3d0
commit
f8893efb94
@ -64,7 +64,7 @@ final class StandardPacketBroadcaster implements PacketBroadcaster{
|
|||||||
$compressor = $compressors[$compressorId];
|
$compressor = $compressors[$compressorId];
|
||||||
|
|
||||||
$threshold = $compressor->getCompressionThreshold();
|
$threshold = $compressor->getCompressionThreshold();
|
||||||
if($threshold !== null && $packetBufferTotalLengths[$bufferId] >= $threshold){
|
if(count($compressorTargets) > 1 && $threshold !== null && $packetBufferTotalLengths[$bufferId] >= $threshold){
|
||||||
//do not prepare shared batch unless we're sure it will be compressed
|
//do not prepare shared batch unless we're sure it will be compressed
|
||||||
$stream = new BinaryStream();
|
$stream = new BinaryStream();
|
||||||
PacketBatch::encodeRaw($stream, $packetBuffers[$bufferId]);
|
PacketBatch::encodeRaw($stream, $packetBuffers[$bufferId]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user