check the size of byte array, greater or lesser
This commit is contained in:
parent
d6c6bfe9f0
commit
fee531f9c1
@ -139,12 +139,14 @@ func (a *agent) read() (data []byte, err error) {
|
||||
l := int(common.BytesToUint32([4]byte{data[start+8],
|
||||
data[start+9], data[start+10], data[start+11]}))
|
||||
total := l + 12
|
||||
if total == tl {
|
||||
if total == tl { // data is what we want
|
||||
return
|
||||
} else {
|
||||
} else if total < tl{ // data[:total] is what we want, data[total:] is the more
|
||||
a.in <- data[total:]
|
||||
data = data[:total]
|
||||
return
|
||||
} else { // ops!
|
||||
break
|
||||
}
|
||||
} else {
|
||||
start++
|
||||
|
Loading…
Reference in New Issue
Block a user