From a77dd08dd9ff2641bf505facfad82ef070c17136 Mon Sep 17 00:00:00 2001 From: Chelsea Holland Komlo Date: Fri, 30 Mar 2018 17:15:56 -0400 Subject: [PATCH] prevent double close due to error in creating listener --- nomad/server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nomad/server.go b/nomad/server.go index 819ad22ad..fbe2545f7 100644 --- a/nomad/server.go +++ b/nomad/server.go @@ -487,7 +487,6 @@ func (s *Server) reloadTLSConnections(newTLSConfig *config.TLSConfig) error { } <-s.listenerCh - s.startRPCListener() listener, err := s.createRPCListener() if err != nil { @@ -495,6 +494,10 @@ func (s *Server) reloadTLSConnections(newTLSConfig *config.TLSConfig) error { return err } + // Ensure that the listener exists before potentially closing it after the + // context for the nomad listener has exited + s.startRPCListener() + // Close and reload existing Raft connections wrapper := tlsutil.RegionSpecificWrapper(s.config.Region, tlsWrap) s.raftLayer.ReloadTLS(wrapper)