1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

fix login

This commit is contained in:
lizheng.lz1998 2020-10-17 17:34:00 +08:00
parent b8a0e75e27
commit b621166549
2 changed files with 10 additions and 14 deletions

View File

@ -955,9 +955,9 @@ func (c *QQClient) connect() error {
}
func (c *QQClient) Disconnect() {
if c.Online {
c.Online = false
c.Conn.Close()
c.Online = false
if c.Conn != nil {
_ = c.Conn.Close()
}
}
@ -1045,7 +1045,7 @@ func (c *QQClient) netLoop() {
reader := binary.NewNetworkReader(c.Conn)
retry := 0
errCount := 0
for c.Online {
for {
l, err := reader.ReadInt32()
if err == io.EOF || err == io.ErrClosedPipe {
c.Error("connection dropped by server: %v", err)
@ -1060,7 +1060,7 @@ func (c *QQClient) netLoop() {
retry++
time.Sleep(time.Second * 3)
if retry > 10 {
c.Online = false
break
}
continue
}
@ -1070,7 +1070,7 @@ func (c *QQClient) netLoop() {
c.Error("parse incoming packet error: %v", err)
errCount++
if errCount > 5 {
c.Online = false
break
}
//log.Println("parse incoming packet error: " + err.Error())
continue

View File

@ -1020,19 +1020,15 @@ func decodeForceOfflinePacket(c *QQClient, _ uint16, payload []byte) (interface{
data.ReadFrom(jce.NewJceReader(request.SBuffer))
r := jce.NewJceReader(data.Map["req_PushForceOffline"]["PushNotifyPack.RequestPushForceOffline"][1:])
tips := r.ReadString(2)
if c.Online {
c.lastLostMsg = tips
c.Online = false
}
c.lastLostMsg = tips
c.Online = false
return nil, nil
}
// StatSvc.ReqMSFOffline
func decodeMSFOfflinePacket(c *QQClient, _ uint16, _ []byte) (interface{}, error) {
if c.Online {
c.lastLostMsg = "服务器端强制下线."
c.Online = false
}
c.lastLostMsg = "服务器端强制下线."
c.Online = false
return nil, nil
}