From 5334b50533202a5421754ff15b780c1b1fa8ae02 Mon Sep 17 00:00:00 2001 From: Xing Xing Date: Tue, 11 Mar 2014 10:03:00 +0800 Subject: [PATCH] fixed #34 --- client/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/client.go b/client/client.go index 5e12dbb..b98dffe 100644 --- a/client/client.go +++ b/client/client.go @@ -185,12 +185,12 @@ func (client *Client) do(funcname string, data []byte, mutex.Lock() client.lastcall = "c" client.innerHandler["c"] = func(resp *Response) { + defer mutex.Unlock() if resp.DataType == dtError { err = getError(resp.Data) return } handle = resp.Handle - mutex.Unlock() } id := IdGen.Id() req := getJob(id, []byte(funcname), data) @@ -249,12 +249,12 @@ func (client *Client) Status(handle string) (status *Status, err error) { mutex.Lock() client.lastcall = "s" + handle client.innerHandler["s"+handle] = func(resp *Response) { + defer mutex.Unlock() var err error status, err = resp._status() if err != nil { client.err(err) } - mutex.Unlock() } req := getRequest() req.DataType = dtGetStatus