From 7d45131f376917f38f60c33bcf3be3c19343c108 Mon Sep 17 00:00:00 2001 From: Stuckinaboot Date: Thu, 14 Mar 2019 14:01:37 -0400 Subject: [PATCH] Add return value to Notify --- libp2p/network/network_interface.py | 1 + libp2p/network/swarm.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/libp2p/network/network_interface.py b/libp2p/network/network_interface.py index acd20b1..71e813c 100644 --- a/libp2p/network/network_interface.py +++ b/libp2p/network/network_interface.py @@ -46,4 +46,5 @@ class INetwork(ABC): def notify(self, notifee): """ :param notifee: object implementing Notifee interface + :return: true if notifee registered successfully, false otherwise """ diff --git a/libp2p/network/swarm.py b/libp2p/network/swarm.py index daabb64..f2943ba 100644 --- a/libp2p/network/swarm.py +++ b/libp2p/network/swarm.py @@ -175,9 +175,12 @@ class Swarm(INetwork): def notify(self, notifee): """ :param notifee: object implementing Notifee interface + :return: true if notifee registered successfully, false otherwise """ if isinstance(notifee, INotifee): self.notifees.append(notifee) + return True + return False def add_transport(self, transport): # TODO: Support more than one transport