read more
This commit is contained in:
parent
fee531f9c1
commit
cd1bd72a80
@ -108,9 +108,13 @@ func (a *agent) Work() {
|
||||
|
||||
// Internal read
|
||||
func (a *agent) read() (data []byte, err error) {
|
||||
if len(a.in) > 0 {
|
||||
BEGIN:
|
||||
inlen := len(a.in)
|
||||
if inlen > 0 {
|
||||
// in queue is not empty
|
||||
data = <-a.in
|
||||
for i := 0; i < inlen; i ++ {
|
||||
data = append(data, <-a.in...)
|
||||
}
|
||||
} else {
|
||||
for {
|
||||
buf := make([]byte, common.BUFFER_SIZE)
|
||||
@ -145,8 +149,8 @@ func (a *agent) read() (data []byte, err error) {
|
||||
a.in <- data[total:]
|
||||
data = data[:total]
|
||||
return
|
||||
} else { // ops!
|
||||
break
|
||||
} else { // ops! It won't be possible.
|
||||
goto BEGIN
|
||||
}
|
||||
} else {
|
||||
start++
|
||||
|
Loading…
Reference in New Issue
Block a user