removed data race

This commit is contained in:
Josh Baker 2016-08-22 11:05:11 -07:00
parent f549dc92e8
commit 9b5818be06
1 changed files with 2 additions and 2 deletions

View File

@ -82,12 +82,12 @@ func NewServer(
// Close stops listening on the TCP address.
// Already Accepted connections will be closed.
func (s *Server) Close() error {
s.mu.Lock()
defer s.mu.Unlock()
if s.ln == nil {
return errors.New("not serving")
}
s.mu.Lock()
s.done = true
s.mu.Unlock()
return s.ln.Close()
}