Skip to content

Commit

Permalink
make the abort funct easier to read
Browse files Browse the repository at this point in the history
  • Loading branch information
remimendes committed Sep 5, 2023
1 parent ac0bdd3 commit 2d4c5bc
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions drivers/rescontainervbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,24 +643,21 @@ func (t T) cgroupDir() string {
}

func (t *T) Abort(ctx context.Context) bool {
vUp := false
var errUp error = nil

if v, err := t.isVmInVboxCf(); v && err == nil {
vUp, errUp = t.isUp()
}

if errUp != nil {
t.Log().Warn().Msgf("no-abort: %s", errUp)
return false
} else if vUp {
// the local instance is already up.
// let the local start report the unecessary start steps
// but skip further abort tests
return false
} else {
return t.abortPing() || t.abortPeerUp()
if v, err := t.isVmInVboxCf(); err != nil {
t.Log().Err(err).Send()
return true
} else if v {
if isLocalUp, err := t.isUp(); err != nil {
t.Log().Err(err).Send()
return true
} else if isLocalUp {
// the local instance is already up.
// let the local start report the unecessary start steps
// but skip further abort tests
return false
}
}
return t.abortPing() || t.abortPeerUp()
}

func (t *T) abortPing() bool {
Expand Down

0 comments on commit 2d4c5bc

Please sign in to comment.