consul: close raft transport before layer
This commit is contained in:
parent
7f4adceae8
commit
a5d001034e
|
@ -47,6 +47,7 @@ type Server struct {
|
|||
raft *raft.Raft
|
||||
raftLayer *RaftLayer
|
||||
raftStore *raft.SQLiteStore
|
||||
raftTransport *raft.NetworkTransport
|
||||
|
||||
// rpcClients is used to track active clients
|
||||
rpcClients map[net.Conn]struct{}
|
||||
|
@ -179,6 +180,7 @@ func (s *Server) setupRaft() error {
|
|||
|
||||
// Create a transport layer
|
||||
trans := raft.NewNetworkTransport(s.raftLayer, 3, 10*time.Second)
|
||||
s.raftTransport = trans
|
||||
|
||||
// Setup the peer store
|
||||
peers := raft.NewJSONPeers(path, trans)
|
||||
|
@ -233,8 +235,9 @@ func (s *Server) Shutdown() error {
|
|||
}
|
||||
|
||||
if s.raft != nil {
|
||||
s.raft.Shutdown()
|
||||
s.raftTransport.Close()
|
||||
s.raftLayer.Close()
|
||||
s.raft.Shutdown()
|
||||
s.raftStore.Close()
|
||||
s.raft = nil
|
||||
s.raftLayer = nil
|
||||
|
|
|
@ -99,5 +99,4 @@ func TestServer_JoinWAN(t *testing.T) {
|
|||
if err := s2.JoinWAN(addr); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
t.Fatalf("fail")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue