You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I start from simple example how to work with evio:
events.Data = func(ec evio.Conn, in []byte) (out []byte, action evio.Action) {
if in == nil {
fmt.Printf("wake from %s\n", ec.RemoteAddr())
return nil, evio.Close
}
c := ec.Context().(*conn)
data := c.is.Begin(in)
for {
leftover, response, err := mcproto(data, b52)
if err != nil {
if err != ErrClose {
// bad thing happened
println(err.Error())
}
action = evio.Close
break
} else if len(leftover) == len(data) {
// request not ready, yet
break
}
// handle the request
out = response//next response may overwrite previous buffer
data = leftover
}
c.is.End(data)
return
}
But out buffer will be overrided in case of piplined requests.
I think we must write to output - like this:
responses := make([]byte, 0)
for {
leftover, response, err := mcproto(data, b52)
// handle the response
responses = append(responses, response...)
//out = response// don't do like this
data = leftover
}
out = responses// do like this
c.is.End(data)
I am not sure what's going on internally - but spent two weeks, for finding that problem)
May be you have this kind of problem in rediconn+evio+pipelined, too
The text was updated successfully, but these errors were encountered:
Hello. I start from simple example how to work with evio:
But out buffer will be overrided in case of piplined requests.
I think we must write to output - like this:
You may find test for that case - here: https://github.com/recoilme/b52/blob/master/main_test.go#L19
I am not sure what's going on internally - but spent two weeks, for finding that problem)
May be you have this kind of problem in rediconn+evio+pipelined, too
The text was updated successfully, but these errors were encountered: