diff --git a/msgio.go b/msgio.go index 378da21..d648674 100644 --- a/msgio.go +++ b/msgio.go @@ -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) { diff --git a/pub.go b/pub.go index 365c6d4..a65ac4d 100644 --- a/pub.go +++ b/pub.go @@ -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) { diff --git a/router.go b/router.go index 69df364..aebb14a 100644 --- a/router.go +++ b/router.go @@ -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) {