Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
agent: mark agent dead when failing to connect
Browse files Browse the repository at this point in the history
Whenever we fail to connect, do not make any more attempts.
More attempts are possible during cleanup phase but we should
not try to connect any more there.

Signed-off-by: Peng Tao <[email protected]>
  • Loading branch information
bergwolf committed Jul 23, 2019
1 parent c472a01 commit 4130913
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions virtcontainers/kata_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ type kataAgent struct {
keepConn bool
proxyBuiltIn bool
dynamicTracing bool
dead bool

vmSocket interface{}
ctx context.Context
Expand Down Expand Up @@ -1581,6 +1582,9 @@ func (k *kataAgent) statsContainer(sandbox *Sandbox, c Container) (*ContainerSta
}

func (k *kataAgent) connect() error {
if k.dead {
return errors.New("Dead agent")
}
// lockless quick pass
if k.client != nil {
return nil
Expand All @@ -1599,6 +1603,7 @@ func (k *kataAgent) connect() error {
k.Logger().WithField("url", k.state.URL).Info("New client")
client, err := kataclient.NewAgentClient(k.ctx, k.state.URL, k.proxyBuiltIn)
if err != nil {
k.dead = true
return err
}

Expand Down

0 comments on commit 4130913

Please sign in to comment.