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()
|
c.conn.Close()
|
||||||
}()
|
}()
|
||||||
rce := NewRedisCommandExecutor(c)
|
rce := NewRedisCommandExecutor(c)
|
||||||
r := bufio.NewReader(c.conn)
|
r := bufio.NewReaderSize(c.conn, 8*1024)
|
||||||
parser := NewRedisParser(r, rce)
|
parser := NewRedisParser(r, rce)
|
||||||
parser.Parse()
|
parser.Parse()
|
||||||
log.Println("client disconnected")
|
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{})
|
return rp.consumer.ConsumeBulkString([]byte{})
|
||||||
default:
|
default:
|
||||||
data := make([]byte, i, i)
|
data := make([]byte, i, i)
|
||||||
var n int
|
for rest := i; rest > 0; {
|
||||||
if n, err = rp.reader.Read(data); err != nil {
|
var n int
|
||||||
return rp.consumer.ConsumeError(err)
|
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 {
|
if _, err = rp.reader.ReadBytes('\n'); err != nil {
|
||||||
return rp.consumer.ConsumeError(err)
|
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