MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / doHeartbeat

Method doHeartbeat

client/base.go:247–268  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

245}
246
247func (c *QQClient) doHeartbeat() {
248 for c.Online.Load() {
249 time.Sleep(270 * time.Second)
250 if !c.Online.Load() {
251 continue
252 }
253 startTime := time.Now().UnixMilli()
254 _, err := c.sendUniPacketAndWait(
255 "trpc.qq_new_tech.status_svc.StatusService.SsoHeartBeat",
256 wtlogin.BuildSSOHeartbeatRequest())
257 if errors.Is(err, network.ErrConnectionClosed) {
258 continue
259 }
260 if err != nil {
261 c.error("heartbeat err %s", err)
262 } else {
263 c.debug("heartbeat %dms to server", time.Now().UnixMilli()-startTime)
264 //TODO: times
265 }
266 }
267 c.debugln("heartbeat task stoped")
268}
269
270// setOnline 设置qq已经上线
271func (c *QQClient) setOnline() {

Callers 1

registerMethod · 0.95

Calls 5

sendUniPacketAndWaitMethod · 0.95
errorMethod · 0.95
debugMethod · 0.95
debuglnMethod · 0.95
BuildSSOHeartbeatRequestFunction · 0.92

Tested by

no test coverage detected