2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-08 12:36:03 +00:00

Improve ssh concurrency on websocket

ssh module was pausing input for the
entire websocket while doing the simple 'write' operation.

Change to background the actual
logon processing,
rather than blocking what should be a fairly trivial write operation.
This commit is contained in:
Jarrod Johnson 2023-08-03 09:56:36 -04:00
parent 89bd798f8b
commit 9a1c9eb43f

View File

@ -120,6 +120,10 @@ class SshShell(conapi.Console):
return
def logon(self):
self.inputmode = -3
eventlet.spawn_n(self.do_logon)
def do_logon(self):
self.ssh = paramiko.SSHClient()
self.ssh.set_missing_host_key_policy(
HostKeyHandler(self.nodeconfig, self.node))
@ -186,6 +190,8 @@ class SshShell(conapi.Console):
if self.inputmode == -2:
self.datacallback(conapi.ConsoleEvent.Disconnect)
return
elif self.inputmode == -3:
return
elif self.inputmode == -1:
while len(data) and data[0:1] == b'\x7f' and len(self.keyaction):
self.datacallback('\b \b') # erase previously echoed value