mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
fix ip report bug
This commit is contained in:
parent
27b97927c1
commit
ca2669a575
11
node/node.go
11
node/node.go
@ -108,10 +108,12 @@ func (c *Node) Start() error {
|
||||
time.Sleep(time.Duration(c.config.UpdatePeriodic) * time.Second)
|
||||
_ = c.userReportPeriodic.Start()
|
||||
}()
|
||||
if c.config.EnableIpRecorder {
|
||||
c.onlineIpReportPeriodic = &task.Periodic{
|
||||
Interval: time.Duration(c.config.UpdatePeriodic) * 30,
|
||||
Interval: time.Duration(c.config.IpRecorderConfig.Periodic) * time.Second,
|
||||
Execute: c.onlineIpReport,
|
||||
}
|
||||
}
|
||||
log.Printf("[%s: %d] Start report online ip", c.nodeInfo.NodeType, c.nodeInfo.NodeId)
|
||||
// delay to start onlineIpReport
|
||||
go func() {
|
||||
@ -381,12 +383,14 @@ func (c *Node) userInfoMonitor() (err error) {
|
||||
}
|
||||
}
|
||||
userTraffic = nil
|
||||
if !c.config.EnableIpRecorder {
|
||||
c.server.ClearOnlineIps(c.Tag)
|
||||
}
|
||||
runtime.GC()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Node) onlineIpReport() (err error) {
|
||||
if c.config.EnableIpRecorder {
|
||||
onlineIp, err := c.server.GetOnlineIps(c.Tag)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
@ -417,9 +421,6 @@ func (c *Node) onlineIpReport() (err error) {
|
||||
} else {
|
||||
c.server.ClearOnlineIps(c.Tag)
|
||||
}
|
||||
} else {
|
||||
c.server.ClearOnlineIps(c.Tag)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user