Skip to content

Commit

Permalink
Minor correction to rarely failed TestConnReaperDeadlock
Browse files Browse the repository at this point in the history
The fix is similar to one of previous commit with deadlock fix
  • Loading branch information
egorse committed Dec 14, 2023
1 parent 4fa0b49 commit 2bf3109
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion msgio.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ func (q *qreader) Close() error {
}

func (q *qreader) addConn(r *Conn) {
go q.listen(q.ctx, r)
q.mu.Lock()
q.sem.enable()
q.rs = append(q.rs, r)
q.mu.Unlock()
go q.listen(q.ctx, r)
}

func (q *qreader) rmConn(r *Conn) {
Expand Down
2 changes: 1 addition & 1 deletion pub.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ func (q *pubQReader) Close() error {
}

func (q *pubQReader) addConn(r *Conn) {
go q.listen(q.ctx, r)
q.mu.Lock()
q.sem.enable()
q.rs = append(q.rs, r)
q.mu.Unlock()
go q.listen(q.ctx, r)
}

func (q *pubQReader) rmConn(r *Conn) {
Expand Down
2 changes: 1 addition & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ func (q *routerQReader) Close() error {
}

func (q *routerQReader) addConn(r *Conn) {
go q.listen(q.ctx, r)
q.mu.Lock()
q.sem.enable()
q.rs = append(q.rs, r)
q.mu.Unlock()
go q.listen(q.ctx, r)
}

func (q *routerQReader) rmConn(r *Conn) {
Expand Down

0 comments on commit 2bf3109

Please sign in to comment.