mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-16 04:24:05 +00:00
Fix
This commit is contained in:
@@ -137,8 +137,6 @@ func (m *Manager) tryGetOutboundTagWithBalancer(tag string, parents []string) st
|
|||||||
|
|
||||||
// AddHandler implements outbound.Manager.
|
// AddHandler implements outbound.Manager.
|
||||||
func (m *Manager) AddHandler(ctx context.Context, handler outbound.Handler) error {
|
func (m *Manager) AddHandler(ctx context.Context, handler outbound.Handler) error {
|
||||||
m.tagsCache.Clear()
|
|
||||||
|
|
||||||
m.defaultHandler.CompareAndSwap(nil, &handler)
|
m.defaultHandler.CompareAndSwap(nil, &handler)
|
||||||
|
|
||||||
tag := handler.Tag()
|
tag := handler.Tag()
|
||||||
@@ -153,6 +151,7 @@ func (m *Manager) AddHandler(ctx context.Context, handler outbound.Handler) erro
|
|||||||
newUntagged = append(newUntagged, *oldUntagged...)
|
newUntagged = append(newUntagged, *oldUntagged...)
|
||||||
newUntagged = append(newUntagged, handler)
|
newUntagged = append(newUntagged, handler)
|
||||||
if m.untaggedHandlers.CompareAndSwap(oldUntagged, &newUntagged) {
|
if m.untaggedHandlers.CompareAndSwap(oldUntagged, &newUntagged) {
|
||||||
|
m.tagsCache.Clear()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,12 +170,11 @@ func (m *Manager) RemoveHandler(ctx context.Context, tag string) error {
|
|||||||
return common.ErrNoClue
|
return common.ErrNoClue
|
||||||
}
|
}
|
||||||
|
|
||||||
m.tagsCache.Clear()
|
|
||||||
|
|
||||||
m.taggedHandler.Delete(tag)
|
m.taggedHandler.Delete(tag)
|
||||||
if cur := m.defaultHandler.Load(); cur != nil && (*cur).Tag() == tag {
|
if cur := m.defaultHandler.Load(); cur != nil && (*cur).Tag() == tag {
|
||||||
m.defaultHandler.CompareAndSwap(cur, nil)
|
m.defaultHandler.CompareAndSwap(cur, nil)
|
||||||
}
|
}
|
||||||
|
m.tagsCache.Clear()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user