Add sync lock to create job functions

Add sync lock to make create job calls thread safe.
This commit is contained in:
Christoffer Fjellström 2017-01-16 16:44:48 +01:00 committed by GitHub
parent b79fee2965
commit d6791e2e42

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 {