mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-14 12:43:24 +02:00
Fix reconnecting to already connected peer address (#1007)
This commit is contained in:
parent
2637debe21
commit
4b04aa562e
6 changed files with 4 additions and 10 deletions
|
|
@ -377,7 +377,7 @@ class SqueakDb:
|
|||
include_locked: bool = False,
|
||||
) -> List[bytes]:
|
||||
""" Lookup squeaks. """
|
||||
logger.info("""Running lookup query with
|
||||
logger.debug("""Running lookup query with
|
||||
addresses: {},
|
||||
min_block: {}
|
||||
max_block: {}
|
||||
|
|
@ -402,7 +402,7 @@ class SqueakDb:
|
|||
if not include_locked:
|
||||
s = s.where(self.squeak_has_secret_key)
|
||||
|
||||
logger.info("Query s: {}".format(s))
|
||||
logger.debug("Query s: {}".format(s))
|
||||
|
||||
with self.get_connection() as connection:
|
||||
# logger.info("Mogrify lookup_squeaks: {}.".format(
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ class NetworkManager(object):
|
|||
host=peer_address.host,
|
||||
port=port,
|
||||
)
|
||||
# TODO: check if address is already connected.
|
||||
if self.connection_manager.has_connection(peer_address):
|
||||
return
|
||||
self.peer_client.connect_address(peer_address)
|
||||
|
||||
def disconnect_peer(self, peer_address: PeerAddress) -> None:
|
||||
|
|
@ -81,9 +82,6 @@ class NetworkManager(object):
|
|||
|
||||
This method blocks until the peer connection has stopped.
|
||||
"""
|
||||
if self.connection_manager.has_connection(address):
|
||||
return
|
||||
|
||||
logger.debug(
|
||||
'Setting up controller for peer address {} ...'.format(address))
|
||||
with Peer(peer_socket, address, outgoing).open_connection(squeak_controller) as peer:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ class PeerConnectionWorker(PeriodicWorker):
|
|||
self.connect_interval_s = connect_interval_s
|
||||
|
||||
def work_fn(self):
|
||||
logger.info("Connecting peers...")
|
||||
self.squeak_controller.connect_saved_peers()
|
||||
|
||||
def get_interval_s(self):
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ class SqueakDeletionWorker(PeriodicWorker):
|
|||
self.clean_interval_s = clean_interval_s
|
||||
|
||||
def work_fn(self):
|
||||
logger.info("Deleting old squeaks...")
|
||||
self.squeak_controller.delete_old_squeaks()
|
||||
|
||||
def get_interval_s(self):
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ class SqueakOfferExpiryWorker(PeriodicWorker):
|
|||
self.clean_interval_s = clean_interval_s
|
||||
|
||||
def work_fn(self):
|
||||
logger.info("Deleting expired offers...")
|
||||
self.squeak_controller.delete_all_expired_received_offers()
|
||||
self.squeak_controller.delete_all_expired_sent_offers()
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ class SqueakPeerSyncWorker(PeriodicWorker):
|
|||
self.sync_interval_s = sync_interval_s
|
||||
|
||||
def work_fn(self):
|
||||
logger.debug("Syncing timeline with peers...")
|
||||
self.squeak_controller.sync_timeline()
|
||||
|
||||
def get_interval_s(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue