Fix: unsubscribe single channel from (p)subscribe.

This commit is contained in:
shankai 2021-07-15 18:44:48 +08:00
parent 0cb26bc5a4
commit 0f365a5602
1 changed files with 1 additions and 3 deletions

View File

@ -1358,14 +1358,12 @@ func (ps *PubSub) unsubscribe(conn Conn, pattern, all bool, channel string) {
} }
} else { } else {
// unsubscribe single channel from (p)subscribe. // unsubscribe single channel from (p)subscribe.
var entry *pubSubEntry
for ient := range sconn.entries { for ient := range sconn.entries {
if ient.pattern == pattern && ient.channel == channel { if ient.pattern == pattern && ient.channel == channel {
removeEntry(entry) removeEntry(ient)
break break
} }
} }
removeEntry(entry)
} }
sconn.dconn.Flush() sconn.dconn.Flush()
} }