Merge pull request #75 from No-ops/patch-1

Add sync lock to create job functions
This commit is contained in:
Christoffer Fjellström 2017-03-02 13:40:41 +01:00 committed by GitHub
commit 9735b2e54f

View File

@ -221,6 +221,8 @@ func (client *Client) do(funcname string, data []byte,
return "", ErrLostConn return "", ErrLostConn
} }
var result = make(chan handleOrError, 1) var result = make(chan handleOrError, 1)
client.Lock()
defer client.Unlock()
client.lastcall = "c" client.lastcall = "c"
client.innerHandler.put("c", func(resp *Response) { client.innerHandler.put("c", func(resp *Response) {
if resp.DataType == dtError { if resp.DataType == dtError {