retrun data slice with correct index

This commit is contained in:
suchj 2012-12-30 02:01:09 +08:00
parent 36ba74f0dc
commit af47a3228f

View File

@ -144,7 +144,7 @@ func (a *agent) unpack(data []byte) ([]byte, int, bool) {
return data, common.PACKET_LEN, true return data, common.PACKET_LEN, true
} else if total < tl { // data[:total] is what we want, data[total:] is the more } else if total < tl { // data[:total] is what we want, data[total:] is the more
a.in <- data[total:] a.in <- data[total:]
data = data[:total] data = data[start:total]
return data, common.PACKET_LEN, true return data, common.PACKET_LEN, true
} else { // ops! It won't be possible. } else { // ops! It won't be possible.
return nil, total - tl, false return nil, total - tl, false