mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-21 16:39:32 +00:00
Decrease max input of ssh connection
Specify connect and login timeouts to avoid sessions being held open. Also, in blocking_scan, wrap everything so that finally can ensure the scan is recognized as complete.
This commit is contained in:
@@ -1738,17 +1738,19 @@ async def blocking_scan(aggressive=False):
|
||||
else:
|
||||
pingscan_result = {}
|
||||
gencheckers = []
|
||||
for iface in pingscan_result:
|
||||
for ipa in pingscan_result[iface]:
|
||||
hwaddr = await neighutil.get_hwaddr(ipa)
|
||||
if not hwaddr:
|
||||
continue
|
||||
if hwaddr in known_info:
|
||||
continue
|
||||
gencheckers.append(generic_eval(ipa, hwaddr))
|
||||
if gencheckers:
|
||||
await asyncio.gather(*gencheckers, return_exceptions=True)
|
||||
scanner = None
|
||||
try:
|
||||
for iface in pingscan_result:
|
||||
for ipa in pingscan_result[iface]:
|
||||
hwaddr = await neighutil.get_hwaddr(ipa)
|
||||
if not hwaddr:
|
||||
continue
|
||||
if hwaddr in known_info:
|
||||
continue
|
||||
gencheckers.append(generic_eval(ipa, hwaddr))
|
||||
if gencheckers:
|
||||
await asyncio.gather(*gencheckers, return_exceptions=True)
|
||||
finally:
|
||||
scanner = None
|
||||
|
||||
|
||||
async def generic_eval(address, hwaddr=None):
|
||||
|
||||
@@ -123,7 +123,9 @@ def connect(target, context=None, disable_hostkey_validation=False, known_hosts=
|
||||
sco = asyncssh.SSHClientConnectionOptions(
|
||||
client_factory=make_client,
|
||||
x509_trusted_cert_paths=None,
|
||||
known_hosts=known_hosts)
|
||||
known_hosts=known_hosts,
|
||||
login_timeout=3,
|
||||
connect_timeout=2)
|
||||
return asyncssh.connect(target, options=sco, **kwargs)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user