This commit is contained in:
Xing Xing 2014-03-11 10:03:00 +08:00
parent da3d31662b
commit 5334b50533

View File

@ -185,12 +185,12 @@ func (client *Client) do(funcname string, data []byte,
mutex.Lock() mutex.Lock()
client.lastcall = "c" client.lastcall = "c"
client.innerHandler["c"] = func(resp *Response) { client.innerHandler["c"] = func(resp *Response) {
defer mutex.Unlock()
if resp.DataType == dtError { if resp.DataType == dtError {
err = getError(resp.Data) err = getError(resp.Data)
return return
} }
handle = resp.Handle handle = resp.Handle
mutex.Unlock()
} }
id := IdGen.Id() id := IdGen.Id()
req := getJob(id, []byte(funcname), data) req := getJob(id, []byte(funcname), data)
@ -249,12 +249,12 @@ func (client *Client) Status(handle string) (status *Status, err error) {
mutex.Lock() mutex.Lock()
client.lastcall = "s" + handle client.lastcall = "s" + handle
client.innerHandler["s"+handle] = func(resp *Response) { client.innerHandler["s"+handle] = func(resp *Response) {
defer mutex.Unlock()
var err error var err error
status, err = resp._status() status, err = resp._status()
if err != nil { if err != nil {
client.err(err) client.err(err)
} }
mutex.Unlock()
} }
req := getRequest() req := getRequest()
req.DataType = dtGetStatus req.DataType = dtGetStatus