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:
|
case dtJobCreated:
|
||||||
resp.Handle = string(dt)
|
resp.Handle = string(dt)
|
||||||
case dtStatusRes, dtWorkData, dtWorkWarning, dtWorkStatus,
|
case dtStatusRes, dtWorkData, dtWorkWarning, dtWorkStatus,
|
||||||
dtWorkComplete, dtWorkFail, dtWorkException:
|
dtWorkComplete, dtWorkException:
|
||||||
s := bytes.SplitN(dt, []byte{'\x00'}, 2)
|
s := bytes.SplitN(dt, []byte{'\x00'}, 2)
|
||||||
if len(s) >= 2 {
|
if len(s) >= 2 {
|
||||||
resp.Handle = string(s[0])
|
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)
|
err = fmt.Errorf("Invalid data: %v", data)
|
||||||
return
|
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:
|
case dtEchoRes:
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user