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

close inner features before resetting

This commit is contained in:
Darien Raymond 2018-02-20 21:22:41 +01:00
parent f0849543ed
commit c335789e40
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
4 changed files with 25 additions and 0 deletions

2
dns.go
View File

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

View File

@ -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) {
if manager == nil {
return
}
m.Close()
m.Lock()
defer m.Unlock()

View File

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

View File

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