Skip to content

Commit

Permalink
In handleLeaveReq, remove session subscriptions directly.
Browse files Browse the repository at this point in the history
Instead of writing to Session.detach.
  • Loading branch information
aforge committed Jul 7, 2023
1 parent 2f632ec commit e776c4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ func (t *Topic) handleLeaveRequest(msg *ClientComMessage, sess *Session) {
// User wants to leave without unsubscribing.
if pssd, _ := t.remSession(sess, asUid); pssd != nil {
if !sess.isProxy() {
sess.detach <- t.name
sess.delSub(t.name)
}
if pssd.isChanSub != asChan {
// Cannot address non-channel subscription as channel and vice versa.
Expand Down
2 changes: 1 addition & 1 deletion server/topic_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (t *Topic) handleProxyLeaveRequest(msg *ClientComMessage, killTimer *time.T
// and we won't be able to find and remove it by its sid.
pssd, result := t.remSession(msg.sess, asUid)
if result {
msg.sess.detach <- t.name
msg.sess.delSub(t.name)
}
if !msg.init {
// Explicitly specify the uid because the master multiplex session needs to know which
Expand Down

0 comments on commit e776c4d

Please sign in to comment.