#1762: Don't perform repetitive decompress.

Pointed out by @sfPlayer1
This commit is contained in:
md_5 2016-04-12 07:55:04 +10:00
parent f070e2d064
commit 4872075bf7
2 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ public class JavaZlib implements BungeeZlib
{ {
inflater.setInput( inData ); inflater.setInput( inData );
while ( !inflater.finished() ) while ( !inflater.finished() && inflater.getTotalIn() < inData.length )
{ {
int count = inflater.inflate( buffer ); int count = inflater.inflate( buffer );
out.writeBytes( buffer, 0, count ); out.writeBytes( buffer, 0, count );

View File

@ -44,7 +44,7 @@ public class NativeZlib implements BungeeZlib
out.memoryAddress(); out.memoryAddress();
Preconditions.checkState( ctx != 0, "Invalid pointer to compress!" ); Preconditions.checkState( ctx != 0, "Invalid pointer to compress!" );
while ( !nativeCompress.finished ) while ( !nativeCompress.finished && ( compress || in.isReadable() ) )
{ {
out.ensureWritable( 8192 ); out.ensureWritable( 8192 );