summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfeistel <6742251-feistel@users.noreply.gitlab.com>2022-04-22 23:06:17 +0200
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2022-04-22 23:06:17 +0200
commite3b1a3e38b95ee5319491d0312c84199a02586e0 (patch)
tree0493225cf0b848f129e342a24eb5ffc6c23519f2
parentc0953bdbc1af5b547d1130cb152e46d83e202186 (diff)
downloadgitlab-shell-e3b1a3e38b95ee5319491d0312c84199a02586e0.tar.gz
feat: replace status mutex with RWMutex
-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 8097e9b..a60fd41 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
}