1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

fix(client): typo

This commit is contained in:
StarHeartHunt 2021-04-25 13:22:27 +08:00
parent 69b3e62e0e
commit aebceb9dcf
2 changed files with 11 additions and 11 deletions

View File

@ -237,7 +237,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
if len(cli.servers) > 3 {
cli.servers = cli.servers[0 : len(cli.servers)/2] // 保留ping值中位数以上的server
}
cli.TCP.PlanedDisconnect(cli.planedDisconnect)
cli.TCP.PlannedDisconnect(cli.plannedDisconnect)
cli.TCP.UnexpectedDisconnect(cli.unexpectedDisconnect)
rand.Read(cli.RandomKey)
go cli.netLoop()
@ -988,8 +988,8 @@ func (c *QQClient) Disconnect() {
c.TCP.Close()
}
func (c *QQClient) planedDisconnect(_ *utils.TCPListener) {
c.Debug("planed disconnect.")
func (c *QQClient) plannedDisconnect(_ *utils.TCPListener) {
c.Debug("planned disconnect.")
c.stat.DisconnectTimes++
c.Online = false
}

View File

@ -10,16 +10,16 @@ import (
type TCPListener struct {
conn net.Conn
planedDisconnect func(*TCPListener)
plannedDisconnect func(*TCPListener)
unexpectedDisconnect func(*TCPListener, error)
}
var ErrConnectionClosed = errors.New("connection closed")
// PlanedDisconnect 预料中的断开连接
// PlannedDisconnect 预料中的断开连接
// 如调用 Close() Connect()
func (t *TCPListener) PlanedDisconnect(f func(*TCPListener)) {
t.planedDisconnect = f
func (t *TCPListener) PlannedDisconnect(f func(*TCPListener)) {
t.plannedDisconnect = f
}
// UnexpectedDisconnect 未预料钟的断开连接
@ -82,7 +82,7 @@ func (t *TCPListener) Close() {
return
}
t.close()
t.invokePlanedDisconnect()
t.invokePlannedDisconnect()
}
func (t *TCPListener) close() {
@ -93,9 +93,9 @@ func (t *TCPListener) close() {
t.conn = nil
}
func (t *TCPListener) invokePlanedDisconnect() {
if t.planedDisconnect != nil {
go t.planedDisconnect(t)
func (t *TCPListener) invokePlannedDisconnect() {
if t.plannedDisconnect != nil {
go t.plannedDisconnect(t)
}
}