Close extra outbound connections in BMConnectionPool.loop()
This commit is contained in:
parent
ab7c500a12
commit
4b8bd3bf9e
|
@ -282,12 +282,18 @@ class BMConnectionPool(object):
|
||||||
)
|
)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
Proxy.onion_proxy = None
|
Proxy.onion_proxy = None
|
||||||
established = sum(
|
|
||||||
1 for c in self.outboundConnections.values()
|
established = [
|
||||||
if (c.connected and c.fullyEstablished))
|
c for c in self.outboundConnections.values()
|
||||||
pending = len(self.outboundConnections) - established
|
if c.connected and c.fullyEstablished]
|
||||||
if established < BMConfigParser().safeGetInt(
|
established_num = len(established)
|
||||||
'bitmessagesettings', 'maxoutboundconnections'):
|
pending = len(self.outboundConnections) - established_num
|
||||||
|
excess = established_num - BMConfigParser().safeGetInt(
|
||||||
|
'bitmessagesettings', 'maxoutboundconnections')
|
||||||
|
if excess > 0:
|
||||||
|
for _ in range(excess):
|
||||||
|
established.pop().handle_close()
|
||||||
|
else:
|
||||||
for i in range(
|
for i in range(
|
||||||
state.maximumNumberOfHalfOpenConnections - pending):
|
state.maximumNumberOfHalfOpenConnections - pending):
|
||||||
try:
|
try:
|
||||||
|
|
Reference in New Issue
Block a user