forked from mirror/redcon
removed data race
This commit is contained in:
parent
f549dc92e8
commit
9b5818be06
|
@ -82,12 +82,12 @@ func NewServer(
|
||||||
// Close stops listening on the TCP address.
|
// Close stops listening on the TCP address.
|
||||||
// Already Accepted connections will be closed.
|
// Already Accepted connections will be closed.
|
||||||
func (s *Server) Close() error {
|
func (s *Server) Close() error {
|
||||||
|
s.mu.Lock()
|
||||||
|
defer s.mu.Unlock()
|
||||||
if s.ln == nil {
|
if s.ln == nil {
|
||||||
return errors.New("not serving")
|
return errors.New("not serving")
|
||||||
}
|
}
|
||||||
s.mu.Lock()
|
|
||||||
s.done = true
|
s.done = true
|
||||||
s.mu.Unlock()
|
|
||||||
return s.ln.Close()
|
return s.ln.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue