mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-04 05:43:06 +00:00
Return false when we haven't subscribed to anything
This commit is contained in:
parent
b93dd9968a
commit
63c977c815
@ -259,6 +259,10 @@ func (p *PubSub) markSeen(id string) {
|
|||||||
// subscribedToMessage returns whether we are subscribed to one of the topics
|
// subscribedToMessage returns whether we are subscribed to one of the topics
|
||||||
// of a given message
|
// of a given message
|
||||||
func (p *PubSub) subscribedToMsg(msg *pb.Message) bool {
|
func (p *PubSub) subscribedToMsg(msg *pb.Message) bool {
|
||||||
|
if len(p.myTopics) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for _, t := range msg.GetTopicIDs() {
|
for _, t := range msg.GetTopicIDs() {
|
||||||
if _, ok := p.myTopics[t]; ok {
|
if _, ok := p.myTopics[t]; ok {
|
||||||
return true
|
return true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user