Fix race condition issue where listner could become nil
This commit is contained in:
parent
5007b240dc
commit
22549b0388
|
@ -46,16 +46,16 @@ func (s *Server) Start() error {
|
|||
}
|
||||
|
||||
// Start accepting connections
|
||||
go func() {
|
||||
go func(l net.Listener) {
|
||||
for {
|
||||
conn, err := s.listener.Accept()
|
||||
conn, err := l.Accept()
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
go s.server.ServeConn(conn)
|
||||
}
|
||||
}()
|
||||
}(s.listener)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue