From 9a1c9eb43ffe5d90e4da3953634d5d3ee16083f2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 3 Aug 2023 09:56:36 -0400 Subject: [PATCH] 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. --- confluent_server/confluent/plugins/shell/ssh.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/confluent_server/confluent/plugins/shell/ssh.py b/confluent_server/confluent/plugins/shell/ssh.py index d88ca9b2..2a6b65ec 100644 --- a/confluent_server/confluent/plugins/shell/ssh.py +++ b/confluent_server/confluent/plugins/shell/ssh.py @@ -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