3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 13:29:27 +01:00

log new listener creation

This commit is contained in:
Shivaram Lingamneni 2018-02-01 15:40:20 -05:00
parent 10b4ec243b
commit bec39ee8cb

View File

@ -1551,6 +1551,12 @@ func (server *Server) loadDatastore(datastorePath string) error {
}
func (server *Server) setupListeners(config *Config) {
logListener := func(addr string, tlsconfig *tls.Config) {
server.logger.Info("listeners",
fmt.Sprintf("now listening on %s, tls=%t.", addr, (tlsconfig != nil)),
)
}
// update or destroy all existing listeners
tlsListeners := config.TLSListeners()
for addr := range server.listeners {
@ -1573,9 +1579,7 @@ func (server *Server) setupListeners(config *Config) {
currentListener.configMutex.Unlock()
if stillConfigured {
server.logger.Info("listeners",
fmt.Sprintf("now listening on %s, tls=%t.", addr, (currentListener.tlsConfig != nil)),
)
logListener(addr, currentListener.tlsConfig)
} else {
// tell the listener it should stop by interrupting its Accept() call:
currentListener.listener.Close()
@ -1591,7 +1595,9 @@ func (server *Server) setupListeners(config *Config) {
_, exists := server.listeners[newaddr]
if !exists {
// make new listener
server.listeners[newaddr] = server.createListener(newaddr, tlsListeners[newaddr])
tlsConfig := tlsListeners[newaddr]
server.listeners[newaddr] = server.createListener(newaddr, tlsConfig)
logListener(newaddr, tlsConfig)
}
}