forked from yuxh/gearman-go
Fixed WORK_FAIL needing 2 arguments
According to http://gearman.org/protocol/ , WORK_FAIL only has 1 argument: the handle
This commit is contained in:
parent
9387a36a0b
commit
e005ea4442
@ -76,7 +76,7 @@ func decodeResponse(data []byte) (resp *Response, l int, err error) {
|
||||
case dtJobCreated:
|
||||
resp.Handle = string(dt)
|
||||
case dtStatusRes, dtWorkData, dtWorkWarning, dtWorkStatus,
|
||||
dtWorkComplete, dtWorkFail, dtWorkException:
|
||||
dtWorkComplete, dtWorkException:
|
||||
s := bytes.SplitN(dt, []byte{'\x00'}, 2)
|
||||
if len(s) >= 2 {
|
||||
resp.Handle = string(s[0])
|
||||
@ -85,6 +85,14 @@ func decodeResponse(data []byte) (resp *Response, l int, err error) {
|
||||
err = fmt.Errorf("Invalid data: %v", data)
|
||||
return
|
||||
}
|
||||
case dtWorkFail:
|
||||
s := bytes.SplitN(dt, []byte{'\x00'}, 2)
|
||||
if len(s) >= 1 {
|
||||
resp.Handle = string(s[0])
|
||||
} else {
|
||||
err = fmt.Errorf("Invalid data: %v", data)
|
||||
return
|
||||
}
|
||||
case dtEchoRes:
|
||||
fallthrough
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user