diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2022-04-26 05:11:24 +0000 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2022-04-26 05:11:24 +0000 |
commit | da4507887f4e17b17b1749ff6b3e9603f3bdad13 (patch) | |
tree | c632687275dc217f7712432cc07ce50f9cf1cdf5 /internal/sshd | |
parent | 01d5f4b095b24187e9bae885be09ed11fbf75e7f (diff) | |
parent | e3b1a3e38b95ee5319491d0312c84199a02586e0 (diff) | |
download | gitlab-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
Diffstat (limited to 'internal/sshd')
-rw-r--r-- | internal/sshd/sshd.go | 6 |
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 } |