prevent double close due to error in creating listener

This commit is contained in:
Chelsea Holland Komlo 2018-03-30 17:15:56 -04:00
parent 402a026c88
commit a77dd08dd9
1 changed files with 4 additions and 1 deletions

View File

@ -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)