mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-18 13:09:08 +02:00
Add finally block after connection to stop peer (#1271)
This commit is contained in:
parent
bb4b66817a
commit
24414ee6ce
1 changed files with 9 additions and 5 deletions
|
|
@ -128,11 +128,15 @@ class NetworkManager(object):
|
|||
|
||||
logger.debug(
|
||||
'Setting up connection for peer address {} ...'.format(address))
|
||||
with Connection(peer, squeak_controller).connect(
|
||||
self.connection_manager
|
||||
) as connection:
|
||||
connection.handle_connection()
|
||||
logger.debug('Stopped connection for peer address {}.'.format(address))
|
||||
try:
|
||||
with Connection(peer, squeak_controller).connect(
|
||||
self.connection_manager
|
||||
) as connection:
|
||||
connection.handle_connection()
|
||||
finally:
|
||||
peer.stop()
|
||||
logger.debug(
|
||||
'Stopped connection for peer address {}.'.format(address))
|
||||
|
||||
@property
|
||||
def local_address(self) -> PeerAddress:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue