Format network.tcp for flake8

This commit is contained in:
Dmitri Bogomolov 2020-06-09 22:37:02 +03:00
parent 54e44eac95
commit 1035d2aec4
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
1 changed files with 11 additions and 11 deletions

View File

@ -80,8 +80,8 @@ class TCPConnection(BMProto, TLSDispatcher):
try: try:
self.local = ( self.local = (
protocol.checkIPAddress( protocol.checkIPAddress(
protocol.encodeHost(self.destination.host), True) and protocol.encodeHost(self.destination.host), True)
not protocol.checkSocksIP(self.destination.host) and not protocol.checkSocksIP(self.destination.host)
) )
except socket.error: except socket.error:
# it's probably a hostname # it's probably a hostname
@ -175,9 +175,9 @@ class TCPConnection(BMProto, TLSDispatcher):
# and having positive or neutral rating # and having positive or neutral rating
filtered = [ filtered = [
(k, v) for k, v in nodes.iteritems() (k, v) for k, v in nodes.iteritems()
if v["lastseen"] > int(time.time()) - if v["lastseen"] > int(time.time())
maximumAgeOfNodesThatIAdvertiseToOthers and - maximumAgeOfNodesThatIAdvertiseToOthers
v["rating"] >= 0 and len(k.host) <= 22 and v["rating"] >= 0 and len(k.host) <= 22
] ]
# sent 250 only if the remote isn't interested in it # sent 250 only if the remote isn't interested in it
elemCount = min( elemCount = min(
@ -408,12 +408,12 @@ class TCPServer(AdvancedDispatcher):
state.ownAddresses[Peer(*sock.getsockname())] = True state.ownAddresses[Peer(*sock.getsockname())] = True
if ( if (
len(connectionpool.BMConnectionPool().inboundConnections) + len(connectionpool.BMConnectionPool().inboundConnections)
len(connectionpool.BMConnectionPool().outboundConnections) > + len(connectionpool.BMConnectionPool().outboundConnections)
BMConfigParser().safeGetInt( > BMConfigParser().safeGetInt(
'bitmessagesettings', 'maxtotalconnections') + 'bitmessagesettings', 'maxtotalconnections')
BMConfigParser().safeGetInt( + BMConfigParser().safeGetInt(
'bitmessagesettings', 'maxbootstrapconnections') + 10 'bitmessagesettings', 'maxbootstrapconnections') + 10
): ):
# 10 is a sort of buffer, in between it will go through # 10 is a sort of buffer, in between it will go through
# the version handshake and return an error to the peer # the version handshake and return an error to the peer