Browse Source

Compress only packets that are larger than 64 bytes

NX 7 years ago
parent
commit
88b5d01cfa
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Source/Native/enet.h

+ 1 - 1
Source/Native/enet.h

@@ -2939,7 +2939,7 @@ extern "C" {
                 }
 
                 #ifdef ENET_LZ4
-                    if (host->compression == 1) {
+                    if (host->compression == 1 && host->packetSize > 64) {
                         size_t originalSize = host->packetSize - sizeof(ENetProtocolHeader), compressedSize = 0;
                         const ENetBuffer* buffers = &host->buffers[1];
                         char * data = (char *)enet_malloc(originalSize);