fix client config cleanup

This commit is contained in:
shoopea
2021-11-26 08:29:09 +08:00
parent 07c2ea7adb
commit d09710eb3d
3 changed files with 13 additions and 18 deletions

11
ttd.go
View File

@@ -138,7 +138,6 @@ func (s *ServerTTD) HeartBeat(stop chan struct{}) {
s.UpdateDate()
s.UpdateClients()
s.UpdateCompanies()
s.UpdateConfigClients()
s.PruneClients()
s.PruneCompanies()
s.ComputeClientTime()
@@ -566,16 +565,6 @@ func (s *ServerTTD) UpdateCompanies() {
s.Status.UpdateCompanies = time.Now()
}
func (s *ServerTTD) UpdateConfigClients() {
for _, cc := range cfg.Clients {
if cc.CompanyID != 255 {
if _, ok := srv.Status.Companies[cc.CompanyID]; !ok {
cc.CompanyID = 255
}
}
}
}
func (s *ServerTTD) PruneClients() {
for cltID, clt := range s.Status.Clients {
if clt.LastSeen.Add(2 * updateHeartBeat).Before(time.Now()) {