@@ -52,6 +52,8 @@ func (d *syncDNSClient) Set(client DNSClient) {
return
}
+ d.Close()
+
d.Lock()
defer d.Unlock()
@@ -84,6 +84,12 @@ func (m *syncInboundHandlerManager) Close() error {
func (m *syncInboundHandlerManager) Set(manager InboundHandlerManager) {
+ if manager == nil {
+ return
+ }
+ m.Close()
m.Lock()
defer m.Unlock()
@@ -161,6 +167,11 @@ func (m *syncOutboundHandlerManager) Close() error {
func (m *syncOutboundHandlerManager) Set(manager OutboundHandlerManager) {
@@ -87,6 +87,8 @@ func (m *syncPolicyManager) Set(manager PolicyManager) {
@@ -54,6 +54,11 @@ func (d *syncDispatcher) Close() error {
func (d *syncDispatcher) Set(disp Dispatcher) {
+ if disp == nil {
@@ -108,6 +113,11 @@ func (r *syncRouter) Close() error {
func (r *syncRouter) Set(router Router) {
+ if router == nil {
+ r.Close()
r.Lock()
defer r.Unlock()