修改websocket bug

This commit is contained in:
liuxiaobo 2025-06-02 15:31:39 +08:00
parent deeeacd6ac
commit a2ecd518aa
4 changed files with 5 additions and 4 deletions

View File

@ -24,5 +24,6 @@ func (s *ClientService) onLogin(cMsg *pb.ClientMsg, msg *pb.S2CUserLogin) {
} }
_ = cMsg _ = cMsg
s.userId = msg.UserId s.userId = msg.UserId
s.client.SetUid(msg.UserId)
log.DebugF("user:%v id:%v login success", s.username, msg.UserId) log.DebugF("user:%v id:%v login success", s.username, msg.UserId)
} }

View File

@ -61,7 +61,7 @@ func newClientService(serviceId int) *ClientService {
func (s *ClientService) loopLoginHour() { func (s *ClientService) loopLoginHour() {
s.login() s.login()
time.AfterFunc(time.Hour, s.loopLoginHour) time.AfterFunc(5*time.Minute, s.loopLoginHour)
} }
func (s *ClientService) OnInit() { func (s *ClientService) OnInit() {

View File

@ -47,5 +47,5 @@ func (s *GateService) onUserLogout(iMsg *ipb.InternalMsg, conn ws.IConn, msg *pb
} }
s.SendClientMsg(conn, iMsg.ServiceName, int32(pb.MsgId_S2CUserLogoutId), msg) s.SendClientMsg(conn, iMsg.ServiceName, int32(pb.MsgId_S2CUserLogoutId), msg)
// 登出的清理工作由WsOnDisconnect实现 // 登出的清理工作由WsOnDisconnect实现
conn.NotifyClose() conn.Close()
} }

View File

@ -1,6 +1,6 @@
1.测试gate 1.测试gate
1.1 每10分钟新起1000个连接发送登陆然后关闭。检查是否有内存及协程泄漏。 1.1 每10分钟新起1000个连接发送登陆然后关闭。检查是否有内存及协程泄漏。(有泄漏)
1.2 启动1000个链接每小时固定发送登陆消息一天后查看连接是否还在。检查心跳机制。 1.2 启动1000个链接每小时固定发送登陆消息一天后查看连接是否还在。检查心跳机制。(已修复)
2.编写db服 2.编写db服
2.1 login服向db服请求数据及向log db服写入日志。测试rpc机制。 2.1 login服向db服请求数据及向log db服写入日志。测试rpc机制。