Skip to content

Commit

Permalink
Merge pull request tinode#819 from tinode/2subs
Browse files Browse the repository at this point in the history
Race condition in subscriptions
  • Loading branch information
or-else authored Jan 14, 2023
2 parents f03a930 + c0d5418 commit 85e27e9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ func (h *Hub) run() {
go topicInit(t, join, h)
} else {
// Topic found.
if t.isInactive() {
// Topic is either not ready or being deleted.
if join.sess.inflightReqs != nil {
join.sess.inflightReqs.Done()
}
join.sess.queueOut(ErrLockedReply(join, join.Timestamp))
continue
}
// Topic will check access rights and send appropriate {ctrl}
select {
case t.reg <- join:
Expand Down Expand Up @@ -383,7 +391,6 @@ func (h *Hub) topicsStateForUser(uid types.Uid, suspended bool) {

// 2. Topic is just being unregistered (topic is going offline)
// 2.1 Unregister it with no further action
//
func (h *Hub) topicUnreg(sess *Session, topic string, msg *ClientComMessage, reason int) error {
now := types.TimeNow()

Expand Down

0 comments on commit 85e27e9

Please sign in to comment.