Add sync lock on do() to avoid race conditions when creating jobs

This commit is contained in:
Christoffer Fjellström 2017-02-03 10:06:27 +01:00
parent b79fee2965
commit 27942f55cd

View File

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