summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Drozdov <idrozdov@gitlab.com>2022-04-26 05:11:24 +0000
committerIgor Drozdov <idrozdov@gitlab.com>2022-04-26 05:11:24 +0000
commitda4507887f4e17b17b1749ff6b3e9603f3bdad13 (patch)
treec632687275dc217f7712432cc07ce50f9cf1cdf5
parent01d5f4b095b24187e9bae885be09ed11fbf75e7f (diff)
parente3b1a3e38b95ee5319491d0312c84199a02586e0 (diff)
downloadgitlab-shell-da4507887f4e17b17b1749ff6b3e9603f3bdad13.tar.gz
Merge branch 'feat/status-rwmutex' into 'main'
feat: replace status mutex with RWMutex See merge request gitlab-org/gitlab-shell!604
-rw-r--r--internal/sshd/sshd.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/sshd/sshd.go b/internal/sshd/sshd.go
index 24e4970..49b8ab9 100644
--- a/internal/sshd/sshd.go
+++ b/internal/sshd/sshd.go
@@ -32,7 +32,7 @@ type Server struct {
Config *config.Config
status status
- statusMu sync.Mutex
+ statusMu sync.RWMutex
wg sync.WaitGroup
listener net.Listener
serverConfig *serverConfig
@@ -139,8 +139,8 @@ func (s *Server) changeStatus(st status) {
}
func (s *Server) getStatus() status {
- s.statusMu.Lock()
- defer s.statusMu.Unlock()
+ s.statusMu.RLock()
+ defer s.statusMu.RUnlock()
return s.status
}