Skip to content

Commit

Permalink
agent: shutdown connection on node stop
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen J Day <[email protected]>
  • Loading branch information
stevvooe committed Jul 30, 2016
1 parent 058bc22 commit 2950f77
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion agent/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ func (n *Node) Stop(ctx context.Context) error {
return ctx.Err()
default:
close(n.stopped)
n.setControlSocket(nil)
// recurse and wait for closure
return n.Stop(ctx)
}
Expand Down Expand Up @@ -430,7 +431,9 @@ func (n *Node) CertificateRequested() <-chan struct{} {
func (n *Node) setControlSocket(conn *grpc.ClientConn) {
n.Lock()
if n.conn != nil {
n.conn.Close()
if err := n.conn.Close(); err != nil {
log.L.WithError(err).Error("closing grpc connection failed")
}
}
n.conn = conn
n.connCond.Broadcast()
Expand Down

0 comments on commit 2950f77

Please sign in to comment.