diff --git a/src/network/bmproto.py b/src/network/bmproto.py index 69f1debb..a175fc43 100644 --- a/src/network/bmproto.py +++ b/src/network/bmproto.py @@ -543,10 +543,12 @@ class BMProto(AdvancedDispatcher, ObjectTracker): self.isSSL = True if not self.verackReceived: return True - print('inside the bmproto line 546') + print('inside the bmproto line') + print('before the value of state are :-{}'.format(self.state)) self.set_state( "tls_init" if self.isSSL else "connection_fully_established", length=self.payloadLength, expectBytes=0) + print('After the value of state are :-{}'.format(self.state)) return False def peerValidityChecks(self): # pylint: disable=too-many-return-statements diff --git a/src/network/dandelion.py b/src/network/dandelion.py index 0adeddd6..6c34f525 100644 --- a/src/network/dandelion.py +++ b/src/network/dandelion.py @@ -105,13 +105,14 @@ class Dandelion(): # pylint: disable=old-style-class #hashMap is has any value # if not [hasmap for hasmap in self.hashMap.items()] ==[]: try: - for k, v in iter({ - k: v for k, v in iter([hasmap for hasamp in self.hashMap.items()]) - if v.child is None - }).items(): - self.hashMap[k] = Stem( - connection, v.stream, self.poissonTimeout()) - invQueue.put((v.stream, k, v.child)) + if self.hashMap: + for k, v in iter({ + k: v for k, v in iter([hasmap for hasmap in self.hashMap.items()]) + if v.child is None + }).items(): + self.hashMap[k] = Stem( + connection, v.stream, self.poissonTimeout()) + invQueue.put((v.stream, k, v.child)) except AttributeError: pass @@ -133,12 +134,13 @@ class Dandelion(): # pylint: disable=old-style-class if connection in self.stem: self.stem.remove(connection) # active mappings to pointing to the removed node + for k in ( k for k, v in iter(self.nodeMap.items()) if v == connection ): self.nodeMap[k] = None for k, v in iter({ - k: v for k, v in iter(self.hashMap.items()) + k: v for k, v in iter(iter([hasmap for hasmap in self.hashMap.items()])) if v.child == connection }).items(): self.hashMap[k] = Stem( diff --git a/src/network/networkthread.py b/src/network/networkthread.py index 2a22367f..ca7cb56c 100644 --- a/src/network/networkthread.py +++ b/src/network/networkthread.py @@ -26,17 +26,17 @@ class BMNetworkThread(StoppableThread): def stopThread(self): super(BMNetworkThread, self).stopThread() - for i in BMConnectionPool().listeningSockets.values(): + for i in [listeningSockets for listeningSockets in BMConnectionPool().listeningSockets.values()]: try: i.close() except: pass - for i in BMConnectionPool().outboundConnections.values(): + for i in [ outboundConnections for outboundConnections in BMConnectionPool().outboundConnections.values()]: try: i.close() except: pass - for i in BMConnectionPool().inboundConnections.values(): + for i in [inboundConnections for inboundConnections in BMConnectionPool().inboundConnections.values()]: try: i.close() except: diff --git a/src/network/tcp.py b/src/network/tcp.py index 61285080..f07d9b1c 100644 --- a/src/network/tcp.py +++ b/src/network/tcp.py @@ -362,7 +362,7 @@ class TCPServer(AdvancedDispatcher): """TCP connection server for Bitmessage protocol""" def __init__(self, host='127.0.0.1', port=8444): - if not '_map' in dir(self): + if '_map' not in dir(self): AdvancedDispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() diff --git a/src/network/tls.py b/src/network/tls.py index 5a0f4c99..33e04f7f 100644 --- a/src/network/tls.py +++ b/src/network/tls.py @@ -67,6 +67,7 @@ class TLSDispatcher(AdvancedDispatcher): # pylint: disable=too-many-instanc self.isSSL = False def state_tls_init(self): + print() """Prepare sockets for TLS handshake""" # pylint: disable=attribute-defined-outside-init self.isSSL = True @@ -94,13 +95,16 @@ class TLSDispatcher(AdvancedDispatcher): # pylint: disable=too-many-instanc ciphers=self.ciphers, do_handshake_on_connect=False) self.sslSocket.setblocking(0) self.want_read = self.want_write = True + print('before tls file python 98 state are :- {}'.format(self.state)) self.set_state("tls_handshake") + print('after tls file python 100 state are :- {}'.format(self.state)) return False # if hasattr(self.socket, "context"): # self.socket.context.set_ecdh_curve("secp256k1") @staticmethod def state_tls_handshake(): + print("tls's state_tls_handshake method in line 107") """Do nothing while TLS handshake is pending, as during this phase we need to react to callbacks instead""" return False @@ -178,6 +182,7 @@ class TLSDispatcher(AdvancedDispatcher): # pylint: disable=too-many-instanc return def tls_handshake(self): + print('inside the tls_handshake') """Perform TLS handshake and handle its stages""" # wait for flush if self.write_buf: