diff --git a/internal/httpauth/client.go b/internal/httpauth/client.go index 614034f99b..ae03201f46 100644 --- a/internal/httpauth/client.go +++ b/internal/httpauth/client.go @@ -137,7 +137,7 @@ func (c *Client) SetNonce(n Nonce) { } func (c *Client) getCurrentNonce() Nonce { - return Nonce(c.nonce) + return Nonce(atomic.LoadUint64(&c.nonce)) } func (c *Client) incrementNonce() { diff --git a/pkg/messaging/link.go b/pkg/messaging/link.go index c98aa5739b..57f4121d42 100644 --- a/pkg/messaging/link.go +++ b/pkg/messaging/link.go @@ -38,8 +38,6 @@ func DefaultLinkConfig() *LinkConfig { // Link represents a messaging connection in the perspective of an instance. type Link struct { rw io.ReadWriteCloser - rMx sync.Mutex - wMx sync.Mutex config *LinkConfig callbacks *Callbacks } @@ -174,9 +172,7 @@ func (c *Link) handleData(payload Frame, n int, err error) error { func (c *Link) writeFrame(t FrameType, body []byte) (int, error) { payload := MakeFrame(t, body) - c.wMx.Lock() n, err := WriteFrame(c.rw, payload) - c.wMx.Unlock() if err != nil { return 0, err }