Fix race condition issue where listner could become nil

This commit is contained in:
Mitchell Hashimoto 2013-05-04 13:29:45 -07:00
parent 5007b240dc
commit 22549b0388
1 changed files with 3 additions and 3 deletions

View File

@ -46,16 +46,16 @@ func (s *Server) Start() error {
} }
// Start accepting connections // Start accepting connections
go func() { go func(l net.Listener) {
for { for {
conn, err := s.listener.Accept() conn, err := l.Accept()
if err != nil { if err != nil {
break break
} }
go s.server.ServeConn(conn) go s.server.ServeConn(conn)
} }
}() }(s.listener)
return nil return nil
} }