Skip to content

Commit

Permalink
close raft long-lived connections
Browse files Browse the repository at this point in the history
  • Loading branch information
chelseakomlo committed Nov 21, 2017
1 parent bab7f0d commit 3ffda28
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nomad/raft_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (l *RaftLayer) Handoff(c net.Conn, ctx context.Context) error {
case <-l.closeCh:
return fmt.Errorf("Raft RPC layer closed")
case <-ctx.Done():
return fmt.Errorf("[INFO] nomad.rpc: Closing server RPC connection")
return fmt.Errorf("[INFO] nomad.rpc: Closing raft RPC connection")
}
}

Expand Down
8 changes: 5 additions & 3 deletions nomad/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,16 @@ func (s *Server) ReloadTLSConnections(newTLSConfig *config.TLSConfig) error {
}
s.rpcListener = list

wrapper := tlsutil.RegionSpecificWrapper(s.config.Region, tlsWrap)
s.raftLayer.ReloadTLS(wrapper)
s.raftTransport.Reload()
time.Sleep(500 * time.Millisecond)

// reinitialize the cancel context
ctx, cancel := context.WithCancel(context.Background())
s.rpcCancel = cancel
go s.listen(ctx)

wrapper := tlsutil.RegionSpecificWrapper(s.config.Region, tlsWrap)
s.raftLayer.ReloadTLS(wrapper)

s.logger.Printf("[INFO] nomad: finished reloading server connections")
return nil
}
Expand Down
13 changes: 13 additions & 0 deletions vendor/github.com/hashicorp/raft/net_transport.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ffda28

Please sign in to comment.