Skip to content

Commit

Permalink
perf 调整rpc注册顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Aug 26, 2024
1 parent 3321f20 commit a0a5dc2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions wcferry/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Client struct {
MsgClient *MsgClient // 消息客户端
}

// 启动 wcf 服务
// 注册消息服务
// return error 错误信息
func (c *Client) Connect() error {
if c.ListenAddr == "" {
Expand All @@ -30,21 +30,21 @@ func (c *Client) Connect() error {
if c.ListenPort == 0 {
c.ListenPort = 10086
}
// 注册 wcf 服务
// 启动 rpc
if err := c.wxInitSDK(); err != nil {
return err
}
// 配置客户端
c.CmdClient = &CmdClient{
pbSocket: newPbSocket(c.ListenAddr, c.ListenPort),
}
c.MsgClient = &MsgClient{
pbSocket: newPbSocket(c.ListenAddr, c.ListenPort+1),
}
// 启动 wcf 服务
if err := c.wxInitSDK(); err != nil {
return err
}
// 自动注销 wcf
// 退出时注销
onquit.Register(func() {
c.CmdClient.Destroy()
c.MsgClient.Destroy()
c.CmdClient.Destroy()
c.wxDestroySDK()
})
// 返回连接结果
Expand Down

0 comments on commit a0a5dc2

Please sign in to comment.