oktopus/backend/services/acs/internal/server/handler/status.go
2024-04-24 14:06:56 -03:00

19 lines
347 B
Go

package handler
import (
"log"
"time"
)
func (h *Handler) handleCpeStatus(cpe string) {
for {
if time.Since(h.Cpes[cpe].LastConnection) > h.acsConfig.KeepAliveInterval {
delete(h.Cpes, cpe)
break
}
time.Sleep(h.acsConfig.KeepAliveInterval)
}
log.Println("CPE", cpe, "is offline")
h.pub("cwmp.v1."+cpe+".status", []byte("0"))
}