fix: should roll back configuration if failure of reload

This commit is contained in:
mzz2017
2023-03-02 22:25:51 +08:00
parent 0433f8d5da
commit c15c0ee410
3 changed files with 54 additions and 12 deletions

View File

@ -155,6 +155,8 @@ func NewControlPlane(
)
defer func() {
if err != nil {
// Flip back.
core.Flip()
_ = core.Close()
}
}()
@ -358,6 +360,9 @@ func NewControlPlane(
func (c *ControlPlane) EjectBpf() *bpfObjects {
return c.core.EjectBpf()
}
func (c *ControlPlane) InjectBpf(bpf *bpfObjects) {
c.core.InjectBpf(bpf)
}
func (c *ControlPlane) dnsUpstreamReadyCallback(raw *url.URL, dnsUpstream *dns.Upstream) (err error) {
// Waiting for ready.