Skip to content

Commit

Permalink
Decrease max chunk size to safely transmit larger messages (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: Kleonikos Kyriakis <[email protected]>
  • Loading branch information
knikos and Kleonikos Kyriakis authored Apr 17, 2024
1 parent 5e6219d commit 4bce183
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/compression/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
// MaxChunkSize a moderate/safe max chunk size is 48KB. This is because the maximum size of a matrix event is 64KB.
// Megolm encryption adds an extra 33% overhead to the encrypted content due to base64 encryption. This means that
// the maximum size of pre-encrypted chunk should be 48KB / 1.33 ~= 36KB. We round down to 35KB to be safe.
MaxChunkSize = 35 << 10 // max pre-encrypted chunk size is 35KB
MaxChunkSize = 30 << 10 // max pre-encrypted chunk size is 30KB - 35KB proved to be an unsafe limit (TODO investigate optimal limit)
)

var encoder, _ = zstd.NewWriter(nil)
Expand Down

0 comments on commit 4bce183

Please sign in to comment.