mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-16 23:30:20 +01:00
Uplift max bulk string size for redisalize server to 8MB. Big TNT explosion seem to write big blocks into the database.
This commit is contained in:
parent
4f49d114c6
commit
1acfd26e80
|
@ -13,6 +13,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const maxBulkStringSize = 8 * 1024 * 1024
|
||||||
|
|
||||||
type RedisConsumer interface {
|
type RedisConsumer interface {
|
||||||
ConsumeInteger(int64) bool
|
ConsumeInteger(int64) bool
|
||||||
ConsumeArray(int64) bool
|
ConsumeArray(int64) bool
|
||||||
|
@ -92,7 +94,7 @@ func (rp *RedisParser) bulkString(line []byte) bool {
|
||||||
case i == 0:
|
case i == 0:
|
||||||
return rp.consumer.ConsumeBulkString([]byte{})
|
return rp.consumer.ConsumeBulkString([]byte{})
|
||||||
default:
|
default:
|
||||||
if i >= 4*1024*1024 { // 4MB should be sufficient
|
if i > maxBulkStringSize { // prevent denial of service.
|
||||||
return rp.consumer.ConsumeError(
|
return rp.consumer.ConsumeError(
|
||||||
fmt.Errorf("Bulk string too large (%d bytes).\n", i))
|
fmt.Errorf("Bulk string too large (%d bytes).\n", i))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user