Skip to content

Commit

Permalink
fix: user goroutine did not exit when ws dial because of token invali…
Browse files Browse the repository at this point in the history
…d or expired

Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com>
  • Loading branch information
FGadvancer committed Aug 14, 2023
1 parent 8cb24ff commit ce1f5ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/login/init_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,14 @@ func (u *LoginMgr) logoutListener(ctx context.Context) {
for {
select {
case <-u.loginMgrCh:
log.ZDebug(ctx, "logoutListener exit")
err := u.logout(ctx, true)
if err != nil {
log.ZError(ctx, "logout error", err)
}
case <-ctx.Done():
log.ZInfo(ctx, "logoutListener done sdk logout.....")
return
}
}

Expand Down Expand Up @@ -350,7 +354,7 @@ func (u *LoginMgr) initResources() {
u.conversationCh = make(chan common.Cmd2Value, 1000)
u.heartbeatCmdCh = make(chan common.Cmd2Value, 10)
u.pushMsgAndMaxSeqCh = make(chan common.Cmd2Value, 1000)
u.loginMgrCh = make(chan common.Cmd2Value)
u.loginMgrCh = make(chan common.Cmd2Value, 1)
u.setLoginStatus(Logout)
u.longConnMgr = interaction.NewLongConnMgr(u.ctx, u.connListener, u.heartbeatCmdCh, u.pushMsgAndMaxSeqCh, u.loginMgrCh)
}
Expand Down

0 comments on commit ce1f5ca

Please sign in to comment.