mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-10 23:20:55 +00:00
Prevent self re-unsubscription
This commit is contained in:
@ -238,9 +238,11 @@ class Pubsub():
|
|||||||
:param topic_id: topic_id to unsubscribe from
|
:param topic_id: topic_id to unsubscribe from
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Return if we already unsubscribed from the topic
|
||||||
|
if topic_id not in self.my_topics:
|
||||||
|
return
|
||||||
# Remove topic_id from map if present
|
# Remove topic_id from map if present
|
||||||
if topic_id in self.my_topics:
|
del self.my_topics[topic_id]
|
||||||
del self.my_topics[topic_id]
|
|
||||||
|
|
||||||
# Create unsubscribe message
|
# Create unsubscribe message
|
||||||
packet = rpc_pb2.RPC()
|
packet = rpc_pb2.RPC()
|
||||||
|
|||||||
Reference in New Issue
Block a user