fix a bug when high qps

This commit is contained in:
JessonChan 2016-04-20 12:54:21 +08:00
parent 21cc8de64f
commit 99c8032384

View File

@ -90,16 +90,22 @@ func (a *agent) work() {
leftdata = data leftdata = data
continue continue
} }
for {
if inpack, l, err = decodeInPack(data); err != nil { if inpack, l, err = decodeInPack(data); err != nil {
a.worker.err(err) a.worker.err(err)
leftdata = data leftdata = data
continue break
} } else {
leftdata = nil leftdata = nil
inpack.a = a inpack.a = a
a.worker.in <- inpack a.worker.in <- inpack
if len(data) == l {
break
}
if len(data) > l { if len(data) > l {
leftdata = data[l:] data = data[l:]
}
}
} }
} }
} }