Fix double unlock in client.go

This commit is contained in:
Zoltán Papp 2024-06-03 20:14:39 +02:00
parent 57ddb5f262
commit 9d44a476c6
2 changed files with 2 additions and 4 deletions

View File

@ -79,16 +79,14 @@ func (c *Client) Connect() error {
defer c.readLoopMutex.Unlock()
c.mu.Lock()
defer c.mu.Unlock()
if c.serviceIsRunning {
c.mu.Unlock()
return nil
}
c.mu.Unlock()
err := c.connect()
if err != nil {
c.mu.Unlock()
return err
}

View File

@ -38,7 +38,7 @@ func DetermineClientMsgType(msg []byte) (MsgType, error) {
case MsgTypeTransport:
return msgType, nil
default:
return 0, fmt.Errorf("invalid msg type: %s", msg)
return 0, fmt.Errorf("invalid msg type, len: %d", len(msg))
}
}