- // Hash it and remember it in seperate array
- $chunkHash = $this->getCryptoInstance()->hashString($chunk);
- $this->chunkHashes[$finalHash][] = $chunkHash;
-
- // Prepend the hash to the chunk
- $chunk = $chunkHash . self::CHUNK_DATA_HASH_SEPERATOR . $this->getNextHexSerialNumber() . self::CHUNK_DATA_HASH_SEPERATOR . $chunk;
-
- // Make sure the chunk is not larger than a TCP package can hold
- assert(strlen($chunk) <= NetworkPackage::TCP_PACKAGE_SIZE);
-
- // Add it to the array
- //* NOISY-DEBUG: */ $this->debugOutput('FRAGMENTER: Adding ' . strlen($chunk) . ' bytes of a chunk.');
- $this->chunks[$finalHash][] = $chunk;
+ // Add the chunk to the propper array and do all the stuff there
+ $this->addChunkData($finalHash, $chunkData);