close inner features before resetting

pull/876/head
Darien Raymond 7 years ago
parent f0849543ed
commit c335789e40
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -52,6 +52,8 @@ func (d *syncDNSClient) Set(client DNSClient) {
return return
} }
d.Close()
d.Lock() d.Lock()
defer d.Unlock() defer d.Unlock()

@ -84,6 +84,12 @@ func (m *syncInboundHandlerManager) Close() error {
} }
func (m *syncInboundHandlerManager) Set(manager InboundHandlerManager) { func (m *syncInboundHandlerManager) Set(manager InboundHandlerManager) {
if manager == nil {
return
}
m.Close()
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()
@ -161,6 +167,11 @@ func (m *syncOutboundHandlerManager) Close() error {
} }
func (m *syncOutboundHandlerManager) Set(manager OutboundHandlerManager) { func (m *syncOutboundHandlerManager) Set(manager OutboundHandlerManager) {
if manager == nil {
return
}
m.Close()
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()

@ -87,6 +87,8 @@ func (m *syncPolicyManager) Set(manager PolicyManager) {
return return
} }
m.Close()
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()

@ -54,6 +54,11 @@ func (d *syncDispatcher) Close() error {
} }
func (d *syncDispatcher) Set(disp Dispatcher) { func (d *syncDispatcher) Set(disp Dispatcher) {
if disp == nil {
return
}
d.Close()
d.Lock() d.Lock()
defer d.Unlock() defer d.Unlock()
@ -108,6 +113,11 @@ func (r *syncRouter) Close() error {
} }
func (r *syncRouter) Set(router Router) { func (r *syncRouter) Set(router Router) {
if router == nil {
return
}
r.Close()
r.Lock() r.Lock()
defer r.Unlock() defer r.Unlock()

Loading…
Cancel
Save