fix data race issue in unit testing cases for gtcp

This commit is contained in:
John
2019-12-13 18:50:54 +08:00
parent 795c7395e6
commit 951ce46932

View File

@ -105,11 +105,11 @@ func (s *Server) SetTLSConfig(tlsConfig *tls.Config) {
// Close closes the listener and shutdowns the server.
func (s *Server) Close() error {
s.mu.Lock()
defer s.mu.Unlock()
if s.listen == nil {
return nil
}
s.mu.Lock()
defer s.mu.Unlock()
return s.listen.Close()
}