Merge pull request #48 from gbarr/large-packet-read

Avoid read channel corruption when response size > bufferSize
This commit is contained in:
Xing 2014-08-19 17:11:42 +08:00
commit ccb6f4a24f
2 changed files with 2 additions and 1 deletions

View File

@ -104,6 +104,7 @@ ReadLoop:
} }
if len(leftdata) > 0 { // some data left for processing if len(leftdata) > 0 { // some data left for processing
data = append(leftdata, data...) data = append(leftdata, data...)
leftdata = nil
} }
for { for {
l := len(data) l := len(data)

View File

@ -5,7 +5,7 @@ const (
// queue size // queue size
queueSize = 8 queueSize = 8
// read buffer size // read buffer size
bufferSize = 1024 bufferSize = 8192
// min packet length // min packet length
minPacketLength = 12 minPacketLength = 12