refactor(rpc): 重构 RPC 客户端并添加重连机制

- 更新了 RPC 客户端的初始化和重连逻辑
- 添加了重连函数和最大重试次数的配置
- 优化了与服务器的连接管理
- 调整了端口相关的数据类型
This commit is contained in:
2025-07-17 05:20:30 +08:00
parent b6231f6eb9
commit bf72b91fc6
18 changed files with 131 additions and 46 deletions

View File

@@ -8,6 +8,7 @@ import (
"blazing/common/data/entity"
"blazing/common/data/share"
"blazing/cool"
"github.com/gogf/gf/v2/os/glog"
"github.com/panjf2000/gnet/v2"
@@ -49,7 +50,7 @@ func (s *Server) OnClose(c gnet.Conn, _ error) (action gnet.Action) {
t := v.GetPlayer()
if t != nil {
glog.Debug(context.Background(), t.UserID, "断开连接")
cool.Mainplayer.Delete(t.UserID)
share.ShareManager.DeleteUserOnline(t.UserID) //设置用户登录服务器
}