optimize: refine reloading

This commit is contained in:
mzz2017 2023-03-07 06:38:06 +08:00
parent 5807a7c11a
commit d226d799b7

View File

@ -156,12 +156,18 @@ loop:
} else {
log.Warnln("[Reload] Stopped old control plane")
}
// Inject bpf objects into the new control plane life-cycle.
newC.InjectBpf(obj)
c.Close()
// Prepare new context.
oldC := c
c = newC
conf = newConf
reloading = true
// Ready to close.
oldC.Close()
default:
break loop
}