mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00:18 +01:00
Recieve larger bulk strings than 4k from redis client.
This commit is contained in:
parent
2e47262ce8
commit
d2e9984529
@ -39,7 +39,7 @@ func (c *Connection) Run() {
|
||||
c.conn.Close()
|
||||
}()
|
||||
rce := NewRedisCommandExecutor(c)
|
||||
r := bufio.NewReader(c.conn)
|
||||
r := bufio.NewReaderSize(c.conn, 8*1024)
|
||||
parser := NewRedisParser(r, rce)
|
||||
parser.Parse()
|
||||
log.Println("client disconnected")
|
||||
|
11
parser.go
11
parser.go
@ -93,14 +93,17 @@ func (rp *RedisParser) bulkString(line []byte) bool {
|
||||
return rp.consumer.ConsumeBulkString([]byte{})
|
||||
default:
|
||||
data := make([]byte, i, i)
|
||||
var n int
|
||||
if n, err = rp.reader.Read(data); err != nil {
|
||||
return rp.consumer.ConsumeError(err)
|
||||
for rest := i; rest > 0; {
|
||||
var n int
|
||||
if n, err = rp.reader.Read(data[i-rest : i]); err != nil {
|
||||
return rp.consumer.ConsumeError(err)
|
||||
}
|
||||
rest -= int64(n)
|
||||
}
|
||||
if _, err = rp.reader.ReadBytes('\n'); err != nil {
|
||||
return rp.consumer.ConsumeError(err)
|
||||
}
|
||||
return rp.consumer.ConsumeBulkString(data[0:n])
|
||||
return rp.consumer.ConsumeBulkString(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user