~rockorager/go-jmap-devel

1

[PATCH 2/2] client: don't double unlock if no session exists already

Silvan Jegen <s.jegen@gmail.com>
Details
Message ID
<20250104215334.59616-1-s.jegen@gmail.com>
DKIM signature
pass
Download raw message
Patch: +2 -1
We should only call Unlock in the case that we didn't call Authenticate()
before, otherwise we would unlock the mutex twice (which will cause a
runtime error).
---
 client.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/client.go b/client.go
index 3b541a9..33aa553 100644
--- a/client.go
+++ b/client.go
@@ -112,8 +112,9 @@ func (c *Client) Do(req *Request) (*Response, error) {
		if err != nil {
			return nil, err
		}
	} else {
		c.Unlock()
	}
	c.Unlock()
	// Check the required capabilities before making the request
	for _, uri := range req.Using {
		c.Lock()
-- 
2.47.1
Silvan Jegen <s.jegen@gmail.com>
Details
Message ID
<30IOUUWX07D65.2US9DYO3ZME9E@homearch.localdomain>
In-Reply-To
<20250104215334.59616-1-s.jegen@gmail.com> (view parent)
DKIM signature
pass
Download raw message
Silvan Jegen <s.jegen@gmail.com> wrote:
> We should only call Unlock in the case that we didn't call Authenticate()
> before, otherwise we would unlock the mutex twice (which will cause a
> runtime error).

Please ignore this duplicate one. I thought sending the mail failed but
it was just sent in a thread (like it should) and I didn't realise it
when looking at https://lists.sr.ht/~rockorager/go-jmap-devel/
Reply to thread Export thread (mbox)