From 402a026c88164f9376220adc9ac823f437db97f4 Mon Sep 17 00:00:00 2001 From: Chelsea Holland Komlo Date: Fri, 30 Mar 2018 14:05:00 -0400 Subject: [PATCH] add further error handling for rpc connection handling --- nomad/server.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nomad/server.go b/nomad/server.go index cbcabc73e..819ad22ad 100644 --- a/nomad/server.go +++ b/nomad/server.go @@ -476,7 +476,16 @@ func (s *Server) reloadTLSConnections(newTLSConfig *config.TLSConfig) error { s.connPool.ReloadTLS(tlsWrap) // reinitialize our rpc listener - s.rpcListener.Close() + if s.rpcListener == nil { + s.logger.Println("Unable to reload configuration due to uninitialized rpc listner") + return nil + } + + if err := s.rpcListener.Close(); err != nil { + s.logger.Printf("[ERR] nomad: Unable to close rpc listener %s", err) + return err + } + <-s.listenerCh s.startRPCListener()