fix: dns memory leak

It can be properly working after xray-core accept the patch
This commit is contained in:
Senis John 2022-12-31 12:35:55 +08:00
parent 21e0ebc428
commit 6477ef6c44
No known key found for this signature in database
GPG Key ID: 845E9E4727C3E1A4

View File

@ -48,7 +48,6 @@ type Controller struct {
stm stats.Manager
dispatcher *mydispatcher.DefaultDispatcher
startAt time.Time
dnsFeature *features.Feature
}
type periodicTask struct {
@ -663,15 +662,7 @@ func (c *Controller) addNewDNS(newNodeInfo *api.NodeInfo) error {
return err
}
if feature, ok := obj.(features.Feature); ok {
// todo fix memory leak
c.Lock()
defer c.Unlock()
if c.dnsFeature == nil {
c.dnsFeature = &feature
c.server.AddFeature(feature)
} else {
*c.dnsFeature = feature
}
}
return nil