mirror of https://github.com/status-im/consul.git
consul: Start RPC before Raft, wait to accept connecitons
This commit is contained in:
parent
c0bda92b34
commit
93f4eb0a0f
|
@ -177,6 +177,12 @@ func NewServer(config *Config) (*Server, error) {
|
||||||
shutdownCh: make(chan struct{}),
|
shutdownCh: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the RPC layer
|
||||||
|
if err := s.setupRPC(tlsConfig); err != nil {
|
||||||
|
s.Shutdown()
|
||||||
|
return nil, fmt.Errorf("Failed to start RPC layer: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the Raft server
|
// Initialize the Raft server
|
||||||
if err := s.setupRaft(); err != nil {
|
if err := s.setupRaft(); err != nil {
|
||||||
s.Shutdown()
|
s.Shutdown()
|
||||||
|
@ -203,12 +209,8 @@ func NewServer(config *Config) (*Server, error) {
|
||||||
return nil, fmt.Errorf("Failed to start wan serf: %v", err)
|
return nil, fmt.Errorf("Failed to start wan serf: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the RPC layer
|
// Start listening for RPC requests
|
||||||
if err := s.setupRPC(tlsConfig); err != nil {
|
go s.listen()
|
||||||
s.Shutdown()
|
|
||||||
return nil, fmt.Errorf("Failed to start RPC layer: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +371,6 @@ func (s *Server) setupRPC(tlsConfig *tls.Config) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
s.raftLayer = NewRaftLayer(advertise, tlsConfig)
|
s.raftLayer = NewRaftLayer(advertise, tlsConfig)
|
||||||
go s.listen()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue