From 0d25a8f5b765d4411eab1f93120ba9f406a3a93a Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 29 Sep 2016 23:52:07 +0800 Subject: [PATCH] Use thread replace process --- terminal/ssh_server.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/terminal/ssh_server.py b/terminal/ssh_server.py index 6d79c46a6..5b9f87b2b 100644 --- a/terminal/ssh_server.py +++ b/terminal/ssh_server.py @@ -92,7 +92,6 @@ class SSHServer(paramiko.ServerInterface): }) return paramiko.AUTH_SUCCESSFUL else: - self.client.close() logger.info('Authentication password failed for %(username)s from %(host)s port %(port)s ' % { 'username': username, 'host': self.addr[0], @@ -275,10 +274,6 @@ class JumpServer: 'host': addr[0], 'port': addr[1], }) - raise IndexError - dir(client) - client.close() - return False try: client_channel = self.get_client_channel(client, addr) @@ -360,9 +355,9 @@ class JumpServer: while True: try: client, addr = sock.accept() - process = Process(target=self.handle_ssh_request, args=(client, addr)) - process.daemon = True - process.start() + thread = threading.Thread(target=self.handle_ssh_request, args=(client, addr)) + thread.daemon = True + thread.start() except Exception as e: logger.error('Bind failed: ' + str(e)) traceback.print_exc()