From bec39ee8cb649b3840fa29f90fac5833eaa56d00 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 1 Feb 2018 15:40:20 -0500 Subject: [PATCH] log new listener creation --- irc/server.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/irc/server.go b/irc/server.go index de0749b1..6f46cb44 100644 --- a/irc/server.go +++ b/irc/server.go @@ -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) } }