in pubsub.go [83:104]
func (l listenerMap) removeAll(conn Writable) (toUnsub [][]byte) {
for channel, list := range l {
for i := 0; i < len(list); i++ {
if list[i] == conn {
list[i] = list[len(list)-1]
list[len(list)-1] = nil
list = list[:len(list)-1]
i--
continue
}
}
if len(list) == 0 {
delete(l, channel)
toUnsub = append(toUnsub, []byte(channel))
} else {
l[channel] = list
}
}
return toUnsub
}