mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-29 15:40:02 +01:00
bind to listening sockets before asyncing
This commit is contained in:
parent
5df8173df2
commit
7db4347419
@ -70,7 +70,7 @@ func NewServer(config *Config) *Server {
|
|||||||
server.loadChannels()
|
server.loadChannels()
|
||||||
|
|
||||||
for _, addr := range config.Server.Listen {
|
for _, addr := range config.Server.Listen {
|
||||||
go server.listen(addr)
|
server.listen(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
signal.Notify(server.signals, SERVER_SIGNALS...)
|
signal.Notify(server.signals, SERVER_SIGNALS...)
|
||||||
@ -189,16 +189,18 @@ func (s *Server) listen(addr string) {
|
|||||||
|
|
||||||
Log.info.Printf("%s listening on %s", s, addr)
|
Log.info.Printf("%s listening on %s", s, addr)
|
||||||
|
|
||||||
for {
|
go func() {
|
||||||
conn, err := listener.Accept()
|
for {
|
||||||
if err != nil {
|
conn, err := listener.Accept()
|
||||||
Log.error.Printf("%s accept error: %s", s, err)
|
if err != nil {
|
||||||
continue
|
Log.error.Printf("%s accept error: %s", s, err)
|
||||||
}
|
continue
|
||||||
Log.debug.Printf("%s accept: %s", s, conn.RemoteAddr())
|
}
|
||||||
|
Log.debug.Printf("%s accept: %s", s, conn.RemoteAddr())
|
||||||
|
|
||||||
s.newConns <- conn
|
s.newConns <- conn
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user