1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

fix setter methods

This commit is contained in:
Darien Raymond 2018-02-20 22:07:58 +01:00
parent 3734195156
commit 955444adc9
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
4 changed files with 6 additions and 9 deletions

3
dns.go
View File

@ -52,10 +52,9 @@ func (d *syncDNSClient) Set(client DNSClient) {
return return
} }
d.Close()
d.Lock() d.Lock()
defer d.Unlock() defer d.Unlock()
common.Close(d.DNSClient)
d.DNSClient = client d.DNSClient = client
} }

View File

@ -88,11 +88,10 @@ func (m *syncInboundHandlerManager) Set(manager InboundHandlerManager) {
return return
} }
m.Close()
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()
common.Close(m.InboundHandlerManager)
m.InboundHandlerManager = manager m.InboundHandlerManager = manager
} }
@ -171,9 +170,9 @@ func (m *syncOutboundHandlerManager) Set(manager OutboundHandlerManager) {
return return
} }
m.Close()
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()
common.Close(m.OutboundHandlerManager)
m.OutboundHandlerManager = manager m.OutboundHandlerManager = manager
} }

View File

@ -87,10 +87,9 @@ func (m *syncPolicyManager) Set(manager PolicyManager) {
return return
} }
m.Close()
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()
common.Close(m.PolicyManager)
m.PolicyManager = manager m.PolicyManager = manager
} }

View File

@ -58,10 +58,10 @@ func (d *syncDispatcher) Set(disp Dispatcher) {
return return
} }
d.Close()
d.Lock() d.Lock()
defer d.Unlock() defer d.Unlock()
common.Close(d.Dispatcher)
d.Dispatcher = disp d.Dispatcher = disp
} }
@ -117,9 +117,9 @@ func (r *syncRouter) Set(router Router) {
return return
} }
r.Close()
r.Lock() r.Lock()
defer r.Unlock() defer r.Unlock()
common.Close(r.Router)
r.Router = router r.Router = router
} }