Rename remote subscription attribute of peer class (#1422)

This commit is contained in:
Jonathan Zernik 2021-09-26 10:57:04 -07:00 committed by GitHub
parent 749ff87468
commit be64e00b3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View file

@ -245,7 +245,7 @@ class Connection(object):
def handle_subscribe(self, msg):
self._send_reply_invs(msg.locator)
self.peer.set_subscription(msg)
self.peer.set_remote_subscription(msg)
def _send_reply_invs(self, locator):
for interest in locator.vInterested:

View file

@ -81,7 +81,7 @@ class Peer(object):
self._num_msgs_sent = 0
self._num_bytes_sent = 0
self._subscription = None
self._remote_subscription = None
self.msg_receiver = MessageReceiver(
self._peer_socket,
@ -105,8 +105,8 @@ class Peer(object):
return self._remote_address
@property
def subscription(self):
return self._subscription
def remote_subscription(self):
return self._remote_subscription
@property
def local_caddress(self):
@ -266,13 +266,13 @@ class Peer(object):
def set_disconnected(self):
self._connect_time = None
def set_subscription(self, subscription):
self._subscription = subscription
def set_remote_subscription(self, subscription):
self._remote_subscription = subscription
def is_subscribed(self, squeak: CSqueak):
if self.subscription is None:
def is_remote_subscribed(self, squeak: CSqueak):
if self.remote_subscription is None:
return False
locator = self.subscription.locator
locator = self.remote_subscription.locator
for interest in locator.vInterested:
if squeak_matches_interest(squeak, interest):
return True

View file

@ -75,7 +75,7 @@ class UpdateSubscribedSecretKeysWorker:
get_hash(squeak).hex(),
))
for peer in self.network_manager.get_connected_peers():
if peer.is_subscribed(squeak):
if peer.is_remote_subscribed(squeak):
logger.debug("Forwarding to peer: {}".format(
peer,
))

View file

@ -75,7 +75,7 @@ class UpdateSubscribedSqueaksWorker:
get_hash(squeak).hex(),
))
for peer in self.network_manager.get_connected_peers():
if peer.is_subscribed(squeak):
if peer.is_remote_subscribed(squeak):
logger.debug("Forwarding to peer: {}".format(
peer,
))