PacketStream: added fromPackets() sugar

This commit is contained in:
Dylan K. Taylor
2019-05-06 19:54:42 +01:00
parent 3415edf600
commit ce61c6e0fd
4 changed files with 18 additions and 12 deletions

View File

@ -1492,10 +1492,7 @@ class Server{
}
$recipients = $ev->getTargets();
$stream = new PacketStream();
foreach($ev->getPackets() as $packet){
$stream->putPacket($packet);
}
$stream = PacketStream::fromPackets(...$ev->getPackets());
if(NetworkCompression::$THRESHOLD < 0 or strlen($stream->getBuffer()) < NetworkCompression::$THRESHOLD){
foreach($recipients as $target){