Skip to content

Commit

Permalink
Merge pull request #480 from Nigirimeshi/fix_datarace
Browse files Browse the repository at this point in the history
fix data race in ActiveClientConn
  • Loading branch information
smallnest committed Jul 24, 2020
2 parents fb13c76 + 005582c commit 530623a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/server.go
Expand Up @@ -125,12 +125,12 @@ func (s *Server) Address() net.Addr {

// ActiveClientConn returns active connections.
func (s *Server) ActiveClientConn() []net.Conn {
result := make([]net.Conn, 0, len(s.activeConn))
s.mu.RLock()
defer s.mu.RUnlock()
result := make([]net.Conn, 0, len(s.activeConn))
for clientConn := range s.activeConn {
result = append(result, clientConn)
}
s.mu.RUnlock()
return result
}

Expand Down

0 comments on commit 530623a

Please sign in to comment.