1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-05 03:23:50 +08:00

fix connection lost.

This commit is contained in:
Mrs4s 2020-11-13 21:54:29 +08:00
parent c1739dba15
commit ede6cb30d3

View File

@ -1129,6 +1129,7 @@ func (c *QQClient) netLoop() {
func (c *QQClient) doHeartbeat() {
c.heartbeatEnabled = true
times := 0
for c.Online {
seq := c.nextSeq()
sso := packets.BuildSsoPacket(seq, c.version.AppId, "Heartbeat.Alive", SystemDeviceInfo.IMEI, []byte{}, c.OutGoingPacketSessionId, []byte{}, c.ksid)
@ -1139,6 +1140,11 @@ func (c *QQClient) doHeartbeat() {
c.Disconnect()
break
}
times++
if times >= 7 {
_ = c.registerClient()
times = 0
}
time.Sleep(time.Second * 30)
}
c.heartbeatEnabled = false