From 3108115570e692383912e260f53b634d91aed833 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Sun, 8 Nov 2020 16:51:18 +0200 Subject: [PATCH] Shorten Bootstrapper methods: handle_close() and set_connection_fully_established() --- src/network/tcp.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/network/tcp.py b/src/network/tcp.py index 64153d9d..1b30a0a2 100644 --- a/src/network/tcp.py +++ b/src/network/tcp.py @@ -366,16 +366,21 @@ def bootstrap(connection_class): """ BMProto.bm_command_addr(self) self._succeed = True - # pylint: disable=attribute-defined-outside-init self.close_reason = "Thanks for bootstrapping!" self.set_state("close") + def set_connection_fully_established(self): + """Only send addr here""" + # pylint: disable=attribute-defined-outside-init + self.fullyEstablished = True + self.sendAddr() + def handle_close(self): """ After closing the connection switch knownnodes.knownNodesActual back to False if the bootstrapper failed. """ - self._connection_base.handle_close(self) + BMProto.handle_close(self) if not self._succeed: knownnodes.knownNodesActual = False