From 27942f55cd2c7813cf8a9ba72e0d526fe9706dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20Fjellstr=C3=B6m?= Date: Fri, 3 Feb 2017 10:06:27 +0100 Subject: [PATCH] Add sync lock on do() to avoid race conditions when creating jobs --- client/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/client.go b/client/client.go index 368363c..b243802 100644 --- a/client/client.go +++ b/client/client.go @@ -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) {