changed embedded mutex to private field (#153)
Some checks failed
test / test (push) Failing after 16m53s
coverage / build (push) Failing after 17m7s
sync / sync (push) Successful in 13s

This commit is contained in:
2025-05-25 03:14:50 +05:00
committed by GitHub
parent 938ddd2ab3
commit 4a6414b2b8
2 changed files with 11 additions and 11 deletions

View File

@@ -28,7 +28,7 @@ type httpStream struct {
address string
ct string
opts client.CallOptions
sync.RWMutex
mu sync.RWMutex
}
var errShutdown = fmt.Errorf("connection is shut down")
@@ -59,8 +59,8 @@ func (h *httpStream) SendMsg(msg interface{}) error {
}
func (h *httpStream) Send(msg interface{}) error {
h.Lock()
defer h.Unlock()
h.mu.Lock()
defer h.mu.Unlock()
if h.isClosed() {
h.err = errShutdown
@@ -80,8 +80,8 @@ func (h *httpStream) RecvMsg(msg interface{}) error {
}
func (h *httpStream) Recv(msg interface{}) error {
h.Lock()
defer h.Unlock()
h.mu.Lock()
defer h.mu.Unlock()
if h.isClosed() {
h.err = errShutdown
@@ -98,8 +98,8 @@ func (h *httpStream) Recv(msg interface{}) error {
}
func (h *httpStream) Error() error {
h.RLock()
defer h.RUnlock()
h.mu.RLock()
defer h.mu.RUnlock()
return h.err
}